From 83d28a8505368aec35ae81f60b8cf27fb0db2945 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Sat, 18 Apr 2026 23:34:02 +0100 Subject: [PATCH] perf(base): defer rows query until base info loads to avoid bland first request --- apps/client/src/features/base/components/base-table.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/client/src/features/base/components/base-table.tsx b/apps/client/src/features/base/components/base-table.tsx index b6c39168..51c587f1 100644 --- a/apps/client/src/features/base/components/base-table.tsx +++ b/apps/client/src/features/base/components/base-table.tsx @@ -44,8 +44,13 @@ export function BaseTable({ baseId }: BaseTableProps) { const activeFilter = activeView?.config?.filter; const activeSorts = activeView?.config?.sorts; + // Hold the rows query until `base` has loaded. Otherwise the query + // fires once with `activeFilter` / `activeSorts` still undefined + // (a "bland" list request), then fires a second time as soon as the + // active view's config resolves — doubling network traffic on every + // base open for any view that has sort or filter. const { data: rowsData, isLoading: rowsLoading, fetchNextPage, hasNextPage, isFetchingNextPage } = - useBaseRowsQuery(baseId, activeFilter, activeSorts); + useBaseRowsQuery(base ? baseId : undefined, activeFilter, activeSorts); const updateRowMutation = useUpdateRowMutation(); const createRowMutation = useCreateRowMutation();