Replies: 2 comments
-
|
Hi @Katona, thanks for the report. |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Created a repo demonstrating the issue: https://github.com/Katona/sitecorecontext-bug. This project has been bootstrapped with Now, if you change the route from any route to the other one (e.g.
The reason behind this seems to be what I have described above, that is, the |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Description
This is a snippet from
src/pages/[[...path]].tsxfile from an app created bycreate-sitecore-jss:The important part is that the
SitecoreContextcomponent is passed thelayoutDataand with that the Sitecore context. However, internally theSitecoreContextcomponent stores the Sitecore context in a state variable and propagates that via React Context. This means when the Sitecore context changes during page navigation for any reason, then the page is rendered first with the 'old' context then when the state is updated inSitecoreContextthe page is re-rendered again with the 'new' context, which of course can lead to bugs.This seems to be a fundamental flaw and given that no one has reported it it's more likely that I am missing something, so please advise.
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions