Send updated client-side storage values when hydrating (#1758)

This commit is contained in:
Masen Furer 2023-09-05 23:27:39 -07:00 committed by GitHub
parent 2e014422f5
commit 393a7c6e2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -25,7 +25,7 @@ export default function Component() {
// Route after the initial page hydration.
useEffect(() => {
const change_complete = () => Event([E('{{state_name}}.{{const.hydrate}}', {})])
const change_complete = () => Event(initialEvents.map((e) => ({...e})))
{{const.router}}.events.on('routeChangeComplete', change_complete)
return () => {
{{const.router}}.events.off('routeChangeComplete', change_complete)

View File

@ -33,6 +33,7 @@ DEFAULT_IMPORTS: imports.ImportDict = {
},
"/utils/context.js": {
ImportVar(tag="EventLoopContext"),
ImportVar(tag="initialEvents"),
ImportVar(tag="StateContext"),
},
"": {ImportVar(tag="focus-visible/dist/focus-visible")},