Skip to content

Commit

Permalink
fix: update fiber cached type, fixes #1139
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Jan 29, 2019
1 parent be79d2f commit 35984ff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/all-possible-containers/src/components/LazyComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'
import { EDIT_ME } from './_editMe'
import Counter from './Counter'

const LazyComponent = () => (
<div>
<fieldset>
<legend>Lazy Component</legend>
{EDIT_ME}
<Counter />
</fieldset>
</div>
)

export default LazyComponent
1 change: 1 addition & 0 deletions src/internal/getReactStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const markUpdate = ({ fiber }) => {
fiber.expirationTime = 1
if (fiber.alternate) {
fiber.alternate.expirationTime = 1
fiber.alternate.type = fiber.type
}
fiber.memoizedProps = Object.assign(
{ cacheBusterProp: true },
Expand Down
1 change: 1 addition & 0 deletions src/reconciler/fiberUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const lazyConstructor = '_ctor'
export const updateLazy = (target, type) => {
const ctor = type[lazyConstructor]
if (target[lazyConstructor] !== type[lazyConstructor]) {
// just execute `import` and RHL.register will do the job
ctor()
}
if (!target[lazyConstructor].isPatchedByReactHotLoader) {
Expand Down

0 comments on commit 35984ff

Please sign in to comment.