Skip to content

Commit 1aae25b

Browse files
revert(tables): drop the ineffective rows-query gate for view resolution
1 parent 78e840b commit 1aae25b

2 files changed

Lines changed: 2 additions & 21 deletions

File tree

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/hooks/use-table.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ interface UseTableParams {
3232
workspaceId: string
3333
tableId: string
3434
queryOptions: QueryOptions
35-
/**
36-
* Holds the rows query until the caller's filter/sort are settled. The wrapper
37-
* resolves the active view asynchronously, so without this the first fetch runs
38-
* against an empty filter and the grid paints the unfiltered set before
39-
* refetching — a visible flash of the wrong rows on every load that adopts a
40-
* default view or opens a `?table-view=` link.
41-
*/
42-
rowsEnabled?: boolean
4335
}
4436

4537
interface FetchNextPageResult {
@@ -96,12 +88,7 @@ export interface UseTableReturn {
9688
* stays in the `Table` component — moving it here would push every keystroke
9789
* through this hook's return value and re-render everything.
9890
*/
99-
export function useTable({
100-
workspaceId,
101-
tableId,
102-
queryOptions,
103-
rowsEnabled = true,
104-
}: UseTableParams): UseTableReturn {
91+
export function useTable({ workspaceId, tableId, queryOptions }: UseTableParams): UseTableReturn {
10592
const queryClient = useQueryClient()
10693
const { data: tableData, isLoading: isLoadingTable } = useTableQuery(workspaceId, tableId)
10794

@@ -128,7 +115,7 @@ export function useTable({
128115
pageSize: TABLE_LIMITS.MAX_QUERY_LIMIT,
129116
filter,
130117
sort: queryOptions.sort,
131-
enabled: Boolean(workspaceId && tableId) && rowsEnabled,
118+
enabled: Boolean(workspaceId && tableId),
132119
})
133120

134121
const rows = useMemo<TableRow[]>(

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,6 @@ export function Table({
358358
((previousName: string, newName: string) => void) | null
359359
>(null)
360360

361-
// Declared before `useTable`: the rows query is gated on `viewsLoaded`, since a
362-
// view owns the filter/sort the query runs with.
363361
const { data: views = NO_VIEWS, isSuccess: viewsLoaded } = useTableViews({
364362
workspaceId,
365363
tableId,
@@ -381,10 +379,6 @@ export function Table({
381379
workspaceId,
382380
tableId,
383381
queryOptions,
384-
// Without this the first fetch runs against an empty filter and the grid
385-
// paints the unfiltered set before refetching. Gates only the first pass —
386-
// `viewsLoaded` stays true after, so later filter edits fetch immediately.
387-
rowsEnabled: !viewsEnabled || viewsLoaded,
388382
})
389383
const createViewMutation = useCreateTableView({ workspaceId, tableId })
390384
const updateViewMutation = useUpdateTableView({ workspaceId, tableId })

0 commit comments

Comments
 (0)