Skip to content

Commit 0ec92c4

Browse files
committed
Rehydration state is now removed after it is initially processed. This resolves issues with hot module reloading.
1 parent 08aa209 commit 0ec92c4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: src/withAsyncComponents.js

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default function withAsyncComponents(app : React$Element) {
5353
if (!rehydrateState.resolved[id]) {
5454
return false;
5555
}
56+
rehydrateState[id] = false;
5657
} else if (defer) {
5758
// Deferred, so return false to stop walking down this branch.
5859
return false;
@@ -79,6 +80,8 @@ export default function withAsyncComponents(app : React$Element) {
7980
return doWalk(appWithAsyncComponents, {}, true)
8081
// Swallow errors.
8182
.catch(() => undefined)
83+
// Ensure that state rehydration is killed
84+
.then(() => { if (typeof window === 'object') { window[STATE_IDENTIFIER] = null; } })
8285
.then(() => ({
8386
appWithAsyncComponents,
8487
state: { resolved: execContext.getResolved() },

0 commit comments

Comments
 (0)