Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: wrong grid row count (#2973)

Daiki Nakashitac12aa66b2a71
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/grid/Grid/Grid.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/grid/Grid/Grid.tsx
index 69bd3e7a0e..3c85c40a71 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/grid/Grid/Grid.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/grid/Grid/Grid.tsx
@@ -40,7 +40,7 @@ export const Grid = ({ viewId }: { viewId: string }) => {
<GridAddRow controller={controller} />
</div>
- <GridTableCount />
+ <GridTableCount rows={rows} />
</div>
{showGridRow && boardRowInfo && (
<EditRow
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.hooks.ts b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.hooks.ts
deleted file mode 100644
index a2ef86a55f..0000000000
--- a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.hooks.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { useAppSelector } from '$app/stores/store';
-
-export const useGridTableCount = () => {
- const { grid } = useAppSelector((state) => state);
- const { rows } = grid;
-
- return {
- count: rows.length,
- };
-};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
index f067a0bad9..727f831a81 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/grid/GridTableCount/GridTableCount.tsx
@@ -1,7 +1,7 @@
-import { useGridTableCount } from './GridTableCount.hooks';
+import { RowInfo } from '@/appflowy_app/stores/effects/database/row/row_cache';
-export const GridTableCount = () => {
- const { count } = useGridTableCount();
+export const GridTableCount = ({ rows }: { rows: readonly RowInfo[] }) => {
+ const count = rows.length;
return (
<span>
Count : <span className='font-semibold'>{count}</span>