-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Preserve current filter state in URL #34 #211
base: master
Are you sure you want to change the base?
Conversation
In some components we were using t() direct from "i18next.
only for doctor's type routes
replace useParam with i18n.language to get language. Language is not used as param but still stays in path.
type url in address bar
pass boolean prop to styled component as 1 || 0
before: url: /sl/wrong-dr-type -> no 404 page after: url: /sl/wrong-dr-type -> 404 page
accept and search not preserved if not default value ("vsi") navigate after doctor type has changed.
Using in Filters is causing unnecesary re-renders
...via useParams() hook
I have just find a small bug. |
todo: filters not updated if user change hash in address bar
src/components/Doctors/MapEvents.js
Outdated
'/', | ||
)}|s-${oldHashValues.search}`; | ||
|
||
navigate(`./#${hash}`); |
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.
It should not push a new entry into the browser history - pressing back button now only changes search parameters in the url, and possibly moving the map view. It should go to the previous page.
Maybe something like:
navigate(`./#${hash}`); | |
navigate(`./#${hash}`, { replace: true }); |
? Didn't test that.
on map events we don't want to add url to history stack
Is |
yes in |
UPDATE #34
This PR has two parts.
First part commits from 722b6ff to 15064e1:
Refactor localization. Package
i18next
is used only for initialization. We are using hook fromreact-i18next
package.Also I removed default language while we are using
LanguageDetector
.Second part commits from d13917a to eaecec6:
Preserve current filter state in URL.
All routes for languages and doctor type are not dynamic.
before:
after:
If this PR is not merged, commit 7c22789 can be still merged. Code is dead.