Skip to content
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

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. #267

Closed
ktsimpso opened this issue Mar 12, 2023 · 1 comment · Fixed by #268
Labels
C-bug Category: bug tribble-reported This issue was reported through Tribble.

Comments

@ktsimpso
Copy link

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 or http://localhost:8080/about notice that the url gets redirected to http://localhost:8080/en-US/ or http://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==

@github-actions github-actions bot added C-bug Category: bug tribble-reported This issue was reported through Tribble. labels Mar 12, 2023
@arctic-hen7
Copy link
Member

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.

arctic-hen7 added a commit that referenced this issue Mar 17, 2023
This fixes #267, but only when global state is unlocalized.
arctic-hen7 added a commit that referenced this issue Apr 3, 2023
* feat: removed localized global state

This completely axes the feature, and returns global state to a
one-per-app system.

BREAKING CHANGE: removed localized global state (global state functions
should no longer take a locale)

* fix: transmitted global state in locale redirection pages

This fixes #267, but only when global state is unlocalized.

* fix: fixed broken examples

* fix: fixed broken demo example

* chore(deps): updated dependencies extensively

Not strictly relevant to this PR, but important nonetheless. Note that
this includes a progression of the `minify-html-onepass` crate version,
which *could* cause problems, so that should be reverted to v0.10.1 if
there are issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug tribble-reported This issue was reported through Tribble.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants