Repository navigation
Conversation
The selected category was only kept in memory, so a page reload reset the notes list to 'All notes'. It is now mirrored to the 'category' query parameter (one-way, store -> URL, re-applied after every navigation since route pushes drop query params) and restored from the URL once when the app loads. Signed-off-by: tahodev <85001874+tahodev@users.noreply.github.com>
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.
What
Implements #2033: the selected category is now persisted across page loads.
The category filter lived only in the pinia store, so every reload reset the list to "All notes". The store selection is now mirrored into the
categoryquery parameter and restored once when the app loads, before the default note routing runs.How
src/Util.js: newqueryWithCategory(query, category)helper. It returns the query with the category applied/removed, ornullwhen unchanged, so the caller never triggers a redundantrouter.replace.src/App.vue: watchers on the store selection and on$routere-apply the parameter after every navigation (route pushes in the app do not carry query params), andloadNotes()restores the selection from the URL beforerouteDefault(), so the first-open note is picked from the filtered list.One-way by design (store -> URL; URL -> store only at load): this keeps every existing
router.pushuntouched and avoids loops between the URL and the store. Back/forward does not change the filter; reloading does, which is the behavior requested in the issue.A category in the URL that no longer exists simply yields an empty list with a working "All notes" escape, the same as selecting such a category in the UI.
Tests
queryWithCategoryinsrc/tests/Util.spec.js(add/keep params/nested names/no-op/replace/clear/no mutation).npx vitest run: 95 passed (4 files).npx eslint src/: 0 errors (3 pre-existing warnings).webpack --node-env productionbuilds clean.Resolves #2033
AI assistance (various models) was used in preparing this change.