Repository navigation
fix(search): normalize the URL without stacking a history entry - #530
Merged
Merged
Conversation
caro3801
force-pushed
the
fix/back-to-insights-link
branch
from
October 5, 2026 06:54
064ac71 to
d98d90e
Compare
Landing on the search page with a bare query (e.g. from the magnifying glass of Insights > Paths) made the view mirror its settings into the URL with a router.push, so the browser's back button led back to the search page instead of the page the user came from. A beforeEnter guard now adds the missing search params from the store with a redirect, which creates no history entry. The view then has nothing to add, and its mirror push targets the same URL, which vue-router drops as a duplicate navigation.
caro3801
force-pushed
the
fix/back-to-insights-link
branch
from
October 5, 2026 07:44
d98d90e to
356e4ab
Compare
…share#2436 checkSearchOrder forced order=asc on any search URL without an order, so a bare query (e.g. from Insights > Paths) sorted by relevance listed the least relevant documents first. A missing or invalid order now falls back to the order from the search settings (desc by default).
…CIJ/datashare#2431 useUrlParamsWithStore compared two arrays with !==, so it always set the store on mount when the URL carried its params. Setters with side effects ran for nothing: SearchSavedList and SearchHistoryList reset the page to 1, which pushed a history entry and broke the back button.
…2431 useUrlParamWithStore checked the URL value for truthiness, so from=0 (e.g. Back to the first page) never reached the store, which kept the previous offset. Only an absent param is now skipped.
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.
fixes ICIJ/datashare#2431
fixes ICIJ/datashare#2436
Bug fix
Landing on the search page with a bare query (e.g. from the magnifying glass of Insights > Paths) made the view mirror its settings into the URL with a
router.push, so the browser's back button led back to the search page instead of the page the user came from.A new
fillSearchRouteQueryguard, last in the search route'sbeforeEnter, adds the missing search params (sort, order, perPage, from...) from the store with a redirect, which creates no history entry. The view then has nothing to add: its mirror push targets the same URL and vue-router drops it as a duplicate navigation.The regression spec (
SearchSettings.spec.js) checks thatwindow.history.lengthdoesn't grow after landing on a bare query.Side quests
checkSearchOrderforcedorder=ascwhen the URL had no order, so the least relevant documents came first. A missing or invalid order now falls back to the order from the search settings (descby default).useUrlParamsWithStorecompared the URL and store arrays with!==, so it always set the store on mount.SearchSavedListandSearchHistoryListreset the page to 1 and pushed a history entry. Now compared withisEqual.from=0never reached the store:useUrlParamWithStorechecked the URL value for truthiness, so Back to the first page left the store on the previous offset. Only an absent param is skipped now.SearchSettings.spec.jsunmounts its wrappers inafterEach, so a failing assertion can't leaveSearchsubscribed to the shared hash history.