diff --git a/src/reconciler/hotReplacementRender.js b/src/reconciler/hotReplacementRender.js index e532d8f91..92a25e360 100644 --- a/src/reconciler/hotReplacementRender.js +++ b/src/reconciler/hotReplacementRender.js @@ -261,18 +261,20 @@ const hotReplacementRender = (instance, stack) => { const next = instance => { // copy over props as long new component may be hidden inside them // child does not have all props, as long some of them can be calculated on componentMount. + const realProps = instance.props const nextProps = { - ...instance.props, + ...realProps, ...(child.nextProps || {}), ...(child.props || {}), } if (isReactClass(instance) && instance.componentWillUpdate) { // Force-refresh component (bypass redux renderedComponent) - instance.componentWillUpdate(nextProps, instance.state) + instance.componentWillUpdate({ ...realProps }, instance.state) } instance.props = nextProps hotReplacementRender(instance, stackChild) + instance.props = realProps } // text node diff --git a/test/reconciler.test.js b/test/reconciler.test.js index ff5cdade8..139165067 100644 --- a/test/reconciler.test.js +++ b/test/reconciler.test.js @@ -128,7 +128,7 @@ describe('reconciler', () => { // what props should be used? Look like the new ones expect(second.willUpdate.mock.calls[0]).toEqual([ - { children: '42', newProp: true, keyId: '2' }, + { children: '42', keyId: '1' }, null, { children: '42', keyId: '1' }, null, @@ -137,7 +137,7 @@ describe('reconciler', () => { expect(second.willUpdate.mock.calls[1]).toEqual([ { children: '42', newProp: true, keyId: '2' }, null, - expect.any(Object), // Flake in React 15. Should be { children: '42', keyId: "1" }, + { children: '42', keyId: '1' }, null, ])