From e8fd2c1b3ce465cb83669ebc9975e3cf5b52bdc1 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 20 Jul 2025 19:12:44 +0300 Subject: [PATCH] fix(views/board): old column not removed when changing it --- .../src/widgets/view_widgets/board_view/api.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 b2e2009b3..39c7bf246 100644 --- a/apps/client/src/widgets/view_widgets/board_view/api.ts +++ b/apps/client/src/widgets/view_widgets/board_view/api.ts @@ -12,7 +12,8 @@ export default class BoardApi { private _columns: string[], private _parentNoteId: string, private viewStorage: ViewModeStorage, - private byColumn: ColumnMap) {} + private byColumn: ColumnMap, + private persistedData: BoardData) {} get columns() { return this._columns; @@ -53,6 +54,14 @@ export default class BoardApi { } async renameColumn(oldValue: string, newValue: string, noteIds: string[]) { + // 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); @@ -69,7 +78,7 @@ export default class BoardApi { viewStorage.store(persistedData); } - return new BoardApi(columns, parentNote.noteId, viewStorage, byColumn); + return new BoardApi(columns, parentNote.noteId, viewStorage, byColumn, persistedData); } }