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
Force full page reload on language change #1291
Conversation
@@ -37,7 +37,8 @@ const LanguageSelector = () => { | |||
const locale = option.target.value; | |||
setCookie("NEXT_LOCALE", locale, { path: "/" }); | |||
const path = router.asPath; | |||
return router.push(path, path, { locale }); | |||
await router.push(path, path, { locale }); | |||
router.reload(); |
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.
Although it's obvious that this will work is there a better way that we can use mutate
to be re-validate the task data?
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.
Right now I want to make it work correctly. I will leave it to others to find a more elegant solution.
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.
That's a fair point and I agree with you.
Won't forcing the user to change task potentially throw away the content they have been writing. We currently tell the user to switch language (in a popup) if we detect it doesn't match the language that it will be submitted as. |
Note: we discussed this a bit in discord and agreed with this sledgehammer solution. When we have to deal with intentionally multi-lingual tasks, we'll think about that more carefully. |
Fixes #1287 by reloading the page every time a user changes their language. When a user changes their language during the a task page, it will re-fetch the task and show either a proper task in their language or show that none exist for that task type.