Bug 2058240: Filters from cookies don't make it into the URL - #1076
Open
kala-moz wants to merge 1 commit into
Open
Bug 2058240: Filters from cookies don't make it into the URL#1076kala-moz wants to merge 1 commit into
kala-moz wants to merge 1 commit into
Conversation
✅ Deploy Preview for mozilla-perfcompare ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug 2058240
Deploy Link
Filters and sort were persisted to both the URL and cookies, and read as
urlParam ?? cookieper column. So opening a shared link fell back to the recipient's own cookies for any column/sort not spelled out in the URL — the same URL showed different results for different people.Introduce an explicit "initialized" URL marker:
On the first load of an uninitialized URL, seed the remembered filter/sort cookies into the URL and stamp it
initialized=1(viareplaceState, so no rerender or loader refetch).Once initialized, filters/sort are read only from the URL — a missing param means the default, never a cookie. Cookies are still written on change so the memory survives for the next fresh visit.
Also read the live URL params when writing filter/sort changes, instead of a memoized snapshot, so an out-of-band param (the seeded marker) isn't clobbered and dropped by a later toggle.
Centralize the query-param/cookie keys and the marker helpers in
tableStatePersistence.ts. Add tests covering: a fresh URL seeds from cookies and gains the marker, an initialized URL ignores cookies, and the marker survives a filter toggle.Co-Authored-By: Claude Opus 4.8