From 6e24af9c6808c4855604e47988612cc03b0d8db0 Mon Sep 17 00:00:00 2001 From: ascarbek Date: Fri, 24 Mar 2023 18:24:28 +0600 Subject: [PATCH] tempfix: rows misfire temp fix --- .../components/_shared/database-hooks/useDatabase.ts | 10 +++++++++- .../stores/effects/database/database_controller.ts | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts index 4f5d013b13..348d1bac30 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/database-hooks/useDatabase.ts @@ -56,7 +56,15 @@ export const useDatabase = (viewId: string, type?: ViewLayoutTypePB) => { void loadFields(fieldInfos); }, }); - await controller.open(); + + const openResult = await controller.open(); + if (openResult.ok) { + setRows( + openResult.val.map((pb) => { + return new RowInfo(viewId, controller.fieldController.fieldInfos, pb); + }) + ); + } if (type === ViewLayoutTypePB.Board) { const fieldId = await controller.getGroupByFieldId(); diff --git a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts index 1f72104b42..f1b181667c 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts +++ b/frontend/appflowy_tauri/src/appflowy_app/stores/effects/database/database_controller.ts @@ -65,7 +65,9 @@ export class DatabaseController { this.databaseViewCache.initializeWithRows(database.rows); this._callback?.onViewChanged?.(database); - return loadGroupResult; + + // temporary fix for grid rows misfire issue + return Ok(database.rows); } else { return Err(openDatabaseResult.val); }