Skip to content

Commit

Permalink
prefer cache value
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Aug 15, 2024
1 parent 51d2ad3 commit d919df2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/TablePagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export type TablePaginationProps<
pagination: Pagination & { count?: number; maxLimit?: number },
) => ReactNode
useLazyListQuery: TypedUseLazyQuery<ResultType, QueryArg, any>
preferCacheValue?: boolean
filters?: Omit<QueryArg, "limit" | "offset">
rowsPerPageOptions?: number[]
stackProps?: StackProps
Expand All @@ -53,6 +54,7 @@ const TablePagination = <
>({
children,
useLazyListQuery,
preferCacheValue,
filters,
page: initialPage = 0,
rowsPerPage: initialLimit = 50,
Expand All @@ -72,8 +74,8 @@ const TablePagination = <
})

useEffect(() => {
trigger({ limit, offset, ...filters } as QueryArg)
}, [trigger, limit, offset, filters])
trigger({ limit, offset, ...filters } as QueryArg, preferCacheValue)
}, [trigger, limit, offset, filters, preferCacheValue])

const { count, max_limit } = result.data || {}

Expand Down

0 comments on commit d919df2

Please sign in to comment.