fix(views/table): booleans not working

This commit is contained in:
Elian Doran 2025-07-13 21:06:41 +03:00
parent 23cef0ab94
commit b93a4a3e42
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View File

@ -159,7 +159,7 @@ export default class TableView extends ViewMode<StateInfo> {
this.api!.on("cellEdited", async (cell) => {
const noteId = cell.getRow().getData().noteId;
const field = cell.getField();
const newValue = cell.getValue();
let newValue = cell.getValue();
if (field === "title") {
server.put(`notes/${noteId}/title`, { title: newValue });
@ -169,6 +169,9 @@ export default class TableView extends ViewMode<StateInfo> {
if (field.includes(".")) {
const [ type, name ] = field.split(".", 2);
if (type === "labels") {
if (typeof newValue === "boolean") {
newValue = newValue ? "true" : "false";
}
setLabel(noteId, name, newValue);
} else if (type === "relations") {
const note = await froca.getNote(noteId);

View File

@ -24,8 +24,6 @@ export async function buildRowDefinitions(parentNote: FNote, notes: FNote[], inf
for (const { name, type } of infos) {
if (type === "relation") {
relations[name] = note.getRelationValue(name);
} else if (type === "boolean") {
labels[name] = note.hasLabel(name);
} else {
labels[name] = note.getLabelValue(name);
}