Skip to content

Commit

Permalink
fix(useDataTable): fix reload to top when filters applied
Browse files Browse the repository at this point in the history
  • Loading branch information
ugogalliano committed Sep 13, 2024
1 parent e4fbd8a commit 799ca28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useDataTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ export function useDataTable<TData>({
const filterableColumnFilters = columnFilters.filter((filter) => {
return filterableColumns.find((column) => column.value === filter.id)
})

const [mounted, setMounted] = useState(false)

useEffect(() => {
Expand Down Expand Up @@ -227,7 +226,9 @@ export function useDataTable<TData>({
}

// After cumulating all the changes, push new params
router.push(`${pathname}?${createQueryString(newParamsObject)}`)
router.push(`${pathname}?${createQueryString(newParamsObject)}`, {
scroll: false,
})

table.setPageIndex(0)

Expand Down

0 comments on commit 799ca28

Please sign in to comment.