Feature/37 reflect selected rules in the url #51
Merged
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.
Description
Solving the #37
Screen.Recording.2025-05-14.at.02.40.13.mov
Type of change
Please see #37
Notes
Query params format
I considered two options for the data format in the URL's query parameters:
rules=REACT&VUE
(use directory keys for clarity).I chose option 2, keeping the Zustand state shape because:
version
field, allowing for data migration using Zustand's persistence features if needed.URL query params length limitations
Since URL parameters can be lengthy, I've compressed them using LZ-String. The package is "complete," so there's no active development, including the absence of an ESM version, which I find acceptable.
Hydration of the zustand state
To overcome the hydration issues, I've decided to show a placeholder if there is a need for hydration (if we have any state in URL params).
Placeholder is plain "Loading..." (I will put it in
translations.ts
or add some nice skeleton - but rooting for your feedback on the approach first 😊)More context in tldr; form - Zustand, and state management is a client thing. Since there are hacky ways of enabling it on server-side, it is not recommended.
More on that: zustand main readme and the whole thread it points to. With some interesting way of doing it 😅
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Important Note for Fork-Based PRs
If you're submitting a PR from a forked repository, please note that E2E tests require specific repository-level environment (
integration
) and secrets to be set up. These are described in.env.example
and include:Please ensure these are properly configured in your fork's repository settings under "Secrets and variables" → "Actions" before running E2E tests.