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

This commit is contained in:
Elian Doran 2025-07-20 19:59:21 +03:00
parent 2b5029cc38
commit b22e08b1eb
No known key found for this signature in database

View File

@ -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) {