Skip to content

Commit 35984ff

Browse files
committed
fix: update fiber cached type, fixes #1139
1 parent be79d2f commit 35984ff

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
import { EDIT_ME } from './_editMe'
3+
import Counter from './Counter'
4+
5+
const LazyComponent = () => (
6+
<div>
7+
<fieldset>
8+
<legend>Lazy Component</legend>
9+
{EDIT_ME}
10+
<Counter />
11+
</fieldset>
12+
</div>
13+
)
14+
15+
export default LazyComponent

Diff for: src/internal/getReactStack.js

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const markUpdate = ({ fiber }) => {
3131
fiber.expirationTime = 1
3232
if (fiber.alternate) {
3333
fiber.alternate.expirationTime = 1
34+
fiber.alternate.type = fiber.type
3435
}
3536
fiber.memoizedProps = Object.assign(
3637
{ cacheBusterProp: true },

Diff for: src/reconciler/fiberUpdater.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const lazyConstructor = '_ctor'
99
export const updateLazy = (target, type) => {
1010
const ctor = type[lazyConstructor]
1111
if (target[lazyConstructor] !== type[lazyConstructor]) {
12+
// just execute `import` and RHL.register will do the job
1213
ctor()
1314
}
1415
if (!target[lazyConstructor].isPatchedByReactHotLoader) {

0 commit comments

Comments
 (0)