Skip to content

Commit

Permalink
reset explorer pagination on table switch
Browse files Browse the repository at this point in the history
  • Loading branch information
macjuul committed Jan 30, 2025
1 parent c18b300 commit 9b11fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/assets/changelogs/3.2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ date: 2025/01/20
- Added an additional instance deletion safety prompt
- Added a button to copy the table name in the table designer
- Fixed table creator validation issues
- Fixed missing Explorer view table panel reveal button
- Fixed missing Explorer view table panel reveal button
- Fixed explorer not resetting to page 1 when changing tables
5 changes: 5 additions & 0 deletions src/screens/surrealist/views/explorer/ExplorerPane/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ export function ExplorerPane({ activeTable, onCreateRecord }: ExplorerPaneProps)
pagination.setTotal(recordCount);
}, [pagination.setTotal, recordCount]);

// biome-ignore lint/correctness/useExhaustiveDependencies: Reset to page 1 when switching tables
useLayoutEffect(() => {
pagination.setCurrentPage(1);
}, [pagination.setCurrentPage, activeTable]);

useEventSubscription(RecordsChangedEvent, refetch);

return (
Expand Down

0 comments on commit 9b11fe4

Please sign in to comment.