feat: persist region filter in URL in and across pages #493
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.
Closes #466.
This PR:
I’m not entirely sure this is the best way to implement this feature, but I couldn’t find any other approach. In Elm Pages, there doesn’t appear to be a straightforward way to manage or track URL changes directly (using anchor elements with preventDefault to change the URL resulted in strange scrolling behavior).
Since this is my first time using Elm Pages, I may be missing a simpler approach. I’d be happy to hear any suggestions on how to do this in a cleaner way, ideally without using JavaScript/ports and direct history manipulation.
Regarding testing, ideally we should test the behavior of storing and retrieving the URL filter, but I haven’t had much success with that either. It seems to me that this is a case where it would be much simpler to test the entire behavior using a framework like the one suggested by @kimadactyl in #492