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
Add call to fetchSiteData when reloadClientData is called in runDevserver.js #1409
Add call to fetchSiteData when reloadClientData is called in runDevserver.js #1409
Conversation
We can't just merge this; it definitely needs a flag. Instead, what the author of #1093 wants is that the |
@SleeplessByte Sure, makes sense. How would you suggest going about it since the current code doesn't refresh the site data? Would it make sense to split out a function that builds the site data route ( |
That would not be a bad idea. How would you go about to merge that data back into the routeData? As in, what's the idea there to update the routeData as the siteData changes? |
im not totally sure what you mean here, probably because I haven't used routeData and siteData together. why would routeData need to be reloaded if the siteData changes? or where should I look to understand this? I checked https://github.com/react-static/react-static/blob/master/packages/react-static/src/static/getRouteData.js but there is no reference to the siteData. is it because the context has state passed to |
actually maybe i dont understand the original comment anymore - it doesnt look like |
Sorry, I was confusing you 😓 😅 . I wasn't talking about react-static/packages/react-static/src/browser/utils/index.js Lines 230 to 235 in 611aa82
Anyway.
Yes, this works perfectly. I just checked and that's how we have it set up for some of our local forks! |
Ah awesome, I'll try this out this evening and post an update then. Thanks 👍 |
Hm, I updated this but actually this doesn't seem to work anymore and I can't see immediately why. Will dig deeper. |
Okay, im no longer sure why things weren't working before. This seems to work for me now, contrary to what the open issue says. @SleeplessByte is this good or am i missing something here? |
Hm, in the issue they only tried to change the code directly in the node_modules folder. This didnt work for me. When i edited the source and published to my own registry and used that instead of react-static everything works as expected. You can try it yourself with |
Hah. You mean it's just working, always :P ? I don't have the capacity right now to try it out, but we can always close this and reopen if you find a circumstance where it doesn't work. |
Oh no sorry I meant it works with the addition of the single line i have added in the PR now |
(it is what was suggested in the open issue) |
It looks fine for me. Tests still pass. I doesn't look breaking. Can you add this to CHANGELOG.md (same format, bottom of the |
done. thanks! |
Thank you for the effort @krishan711 |
Description
Fix for #1093
The suggestion in the issue above was to update the latestState variable directly, but as mentioned this doesn't work. I believe this is primarily because the routes are set already and
before
is not called when the webpack dev server is invalidated.Testing locally this works, just wanted a second opinion before i look into adding tests as it may be overly heavy-handed.
Changes/Tasks
Motivation and Context
comes from #1093. In summary, if you try to call
reloadClientData
in static.config.js the reload happens but the data isn't actually re-retrieved.Types of changes
Checklist: