From 51b462f04319e06fddb13c5cdbc60d80ab045f2c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 29 Jun 2025 16:16:15 +0300 Subject: [PATCH] chore(views/table): bring back restore state --- apps/client/src/widgets/view_widgets/table_view/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/view_widgets/table_view/index.ts b/apps/client/src/widgets/view_widgets/table_view/index.ts index b0e31e204..bdaab52bf 100644 --- a/apps/client/src/widgets/view_widgets/table_view/index.ts +++ b/apps/client/src/widgets/view_widgets/table_view/index.ts @@ -80,9 +80,6 @@ export default class TableView extends ViewMode { } private async renderTable(el: HTMLElement) { - const viewStorage = await this.viewStorage.restore(); - const initialState = viewStorage?.gridState; - const modules = [SortModule, FormatModule, InteractionModule, EditModule, ResizeColumnsModule, FrozenColumnsModule, PersistenceModule]; for (const module of modules) { Tabulator.registerModule(module); @@ -95,6 +92,8 @@ export default class TableView extends ViewMode { const notes = await froca.getNotes(this.args.noteIds); const info = getPromotedAttributeInformation(this.parentNote); + const viewStorage = await this.viewStorage.restore(); + this.persistentData = viewStorage?.tableData || {}; this.api = new Tabulator(el, { index: "noteId", columns: buildColumnDefinitions(info), @@ -103,7 +102,8 @@ export default class TableView extends ViewMode { persistenceWriterFunc: (_id, type: string, data: object) => { this.persistentData[type] = data; this.spacedUpdate.scheduleUpdate(); - } + }, + persistenceReaderFunc: (_id, type: string) => this.persistentData[type], }); this.setupEditing(); }