Using the translation feature as well as having global build state causes an error when the user navigates directly to the root page (or any valid page) when not including the locale in the path.
ktsimpso opened this issue · comments
This issue is reporting a bug in the code of Perseus. Details of the scope will be available in issue labels.
The author described their issue as follows:
Using the translation feature as well as having global build state causes an error when the user navigates directly to the root page (or any valid page) when not including the locale in the path.
The steps to reproduce this issue are as follows:
See MRE repo and navigate directly to
http://localhost:8080
orhttp://localhost:8080
/about notice that the url gets redirected tohttp://localhost:8080/en-US/
orhttp://localhost:8080/en-US/about
as expected but an error in the browser occurs.
This bug requires both translation and some global build state to reproduce.
A minimum reproducible example is available at https://github.com/ktsimpso/perseus_bug_report.
- Hydration-related: false
- The author is willing to attempt a fix: false
Tribble internal data
dHJpYmJsZS1yZXBvcnRlZCxDLWJ1Zw==
This actually raises a much deeper problem as well. Right now, the global state is dependent on the locale, but if a user switches locales, their global state remains unchanged, which could lead to very misleading behavior.
Right now, I think the most logical option is to remove support for localized global state entirely as a breaking change before v0.4.0 goes stable. Short of adding support for a function that amalgamates the global states of different locales which is called whenever global state is thawed as well, I don't think there's any other option. Let me stew on this for a day or so, and then I'll decide how we'll move forward.