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

React sample - set i18n init lang to prevent SSR hydration from re-rendering app #330

Merged

Conversation

kbauer-hhog
Copy link
Contributor

Description

Set i18n initial language based on SSR language or static config defaultLanguage to prevent re-renders in multi-lingual apps during the hydration process.

Motivation

To fix the flicker after initial page load issue when using the React sample. (This issue may exist in the other samples as well.)

How Has This Been Tested?

I have tested local Sitecore 9.3 instance with a JSS 13.0 site and debug via chrome dev tools.
My change simply initializes the language for i18ninit by pulling the SSR language from JSS_STATE, or using the config defaultLanguage setting.
The comments in code seem to support this, but I feel this could be introduced to prevent others from experiencing this issue OOTB.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the Contributing guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.

…ultLanguage to prevent re-renders in multi-lingual apps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants