mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 23:49:03 +00:00
Back/Forward between two history entries of the same table changed the URL but left the old filters in the filter bar and grid, because filters were only read from the URL on mount. Happens on both Next and TanStack; follow-up from #51391. **Changed:** - `useSyncFiltersToUrl` now also syncs URL → filter state for the current table (ignoring our own debounced push, and another table's URL while a TanStack navigation is pending). - State → URL skips pushes the URL already reflects, which also removes the no-op push on every grid mount. - `useTableEditorFiltersSort` returns `path` (same lines as #51391, so they merge cleanly). **Behavior choice:** if a filter is applied and Back/Forward happens before its 500ms debounce fires, the navigation wins and the unpushed filter is discarded, rather than pushing a stale filter over the entry the user navigated to. Back/Forward (`popstate`) cancels the pending push even when the `filter` param is unchanged; other URL changes such as a sort keep it. Documented on the hook. **Added:** - Real-TanStack-router navigation test and a router-agnostic unit test for the sync (master's hook fails 4 of 6). ## To test - Table A → add a filter → open table B → Back (A with filter) → Back (A, filter bar empty, all rows) → Forward (filter back) - Apply a filter and hit Back immediately – you land on the previous entry and the filter isn't re-pushed - Add/remove a sort, Back/Forward – sorts and filters stay in sync with the URL - Reload a filtered + sorted URL – both restored --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>