From 51495b282f496b8bb211abf2ce1b7e07762442ae Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 3 Aug 2025 16:23:18 +0300 Subject: [PATCH] fix(board): items not displayed recursively --- .../widgets/view_widgets/board_view/data.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/client/src/widgets/view_widgets/board_view/data.ts b/apps/client/src/widgets/view_widgets/board_view/data.ts index af36587ba..f468f2292 100644 --- a/apps/client/src/widgets/view_widgets/board_view/data.ts +++ b/apps/client/src/widgets/view_widgets/board_view/data.ts @@ -15,26 +15,26 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per // Get all columns that exist in the notes const columnsFromNotes = [...byColumn.keys()]; - + // Get existing persisted columns and preserve their order const existingPersistedColumns = persistedData.columns || []; const existingColumnValues = existingPersistedColumns.map(c => c.value); - + // Find truly new columns (exist in notes but not in persisted data) const newColumnValues = columnsFromNotes.filter(col => !existingColumnValues.includes(col)); - + // Build the complete correct column list: existing + new const allColumns = [ ...existingPersistedColumns, // Preserve existing order ...newColumnValues.map(value => ({ value })) // Add new columns ]; - + // Remove duplicates (just in case) and ensure we only keep columns that exist in notes or are explicitly preserved const deduplicatedColumns = allColumns.filter((column, index) => { const firstIndex = allColumns.findIndex(c => c.value === column.value); return firstIndex === index; // Keep only the first occurrence }); - + // Ensure all persisted columns have empty arrays in byColumn (even if no notes use them) for (const column of deduplicatedColumns) { if (!byColumn.has(column.value)) { @@ -44,10 +44,10 @@ export async function getBoardData(parentNote: FNote, groupByColumn: string, per // Return updated persisted data only if there were changes let newPersistedData: BoardData | undefined; - const hasChanges = newColumnValues.length > 0 || + const hasChanges = newColumnValues.length > 0 || existingPersistedColumns.length !== deduplicatedColumns.length || !existingPersistedColumns.every((col, idx) => deduplicatedColumns[idx]?.value === col.value); - + if (hasChanges) { newPersistedData = { ...persistedData, @@ -68,6 +68,10 @@ async function recursiveGroupBy(branches: FBranch[], byColumn: ColumnMap, groupB continue; } + if (note.hasChildren()) { + await recursiveGroupBy(note.getChildBranches(), byColumn, groupByColumn); + } + const group = note.getLabelValue(groupByColumn); if (!group) { continue;