-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: set filter correctly when navigating back from details page #263
Conversation
…generate the singleTripQueryString. Thus, the same string is available when the singleTripQueryString is decompressed, making it possible to set the parameters again when navigating back from details page.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Notater fra felles gjennomgang av PR:
|
I was unable to navigate to the details page when |
I think you should use query string instead (https://en.wikipedia.org/wiki/Query_string). For example |
const tripSearchParams = router.query.id | ||
? tripQueryStringToQueryParams(String(router.query.id)) | ||
? tripQueryStringToQueryParams(router.query) | ||
: undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might disagree with me, but I don't think we should modify tripQueryStringToQueryParams
without changing the decompressedQueryString
. What about doing something like this?
const tripSearchParams = router.query.id
? tripQueryStringToQueryParams(String(router.query.id))
: undefined;
if (tripSearchParams && router.query.filter) {
tripSearchParams.append('filter', router.query.filter as string);
}
This only requires us to add the filter as a query param to the href in /trip-pattern/index.tsx
(already done) and to use it when redirecting back to the travel suggestions (the suggested code above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
Closes https://github.com/AtB-AS/kundevendt/issues/17194
Background
When going into a details page and navigating back the filter for transport mode is not included in the query, causing the filter to be reset to default.
Illustrations
The recording displays how the same filters are active before and after navigating to the details page. This can be seen in both the filter buttons and URL parameters.
screenshots/video/figma
Skjermopptak.2024-03-14.kl.12.15.33.mov
Proposed solution
Including a string made up by the selected transport mode filters to generate the singleTripQueryString. Thus, the same string is available when the singleTripQueryString is decompressed, making it possible to set the parameters again when navigating back from details page.
Acceptance Criteria