Skip to content

Build your personal knowledge base with Trilium Notes

refactor(views/board): use bulk API for renaming columns

Elian Doranb22e08b1eba6
diff --git a/apps/client/src/widgets/view_widgets/board_view/api.ts b/apps/client/src/widgets/view_widgets/board_view/api.ts
index 7a706f2e6c..ffec139604 100644
--- a/apps/client/src/widgets/view_widgets/board_view/api.ts
+++ b/apps/client/src/widgets/view_widgets/board_view/api.ts
@@ -55,18 +55,22 @@ export default class BoardApi {
}
async renameColumn(oldValue: string, newValue: string, noteIds: string[]) {
+ // Change the value in the notes.
+ await executeBulkActions(noteIds, [
+ {
+ name: "updateLabelValue",
+ labelName: "status",
+ labelValue: newValue
+ }
+ ]);
+
// Rename the column in the persisted data.
for (const column of this.persistedData.columns || []) {
if (column.value === oldValue) {
column.value = newValue;
}
}
- this.viewStorage.store(this.persistedData);
-
- // Update all notes that have the old status value to the new value
- for (const noteId of noteIds) {
- await attributes.setLabel(noteId, "status", newValue);
- }
+ await this.viewStorage.store(this.persistedData);
}
async removeColumn(column: string) {