From 9da45da9103b2c559d59761c73beedf76533efce Mon Sep 17 00:00:00 2001 From: James Johnson Date: Mon, 8 Jan 2018 16:40:09 +1000 Subject: [PATCH] Move slot.forceUpdate() call into componentWillUpdate - Fixes prop propagation across Slot boundary. --- components/slot-fill/fill.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/components/slot-fill/fill.js b/components/slot-fill/fill.js index 628e434bbf27d3..dd32649554ec9b 100644 --- a/components/slot-fill/fill.js +++ b/components/slot-fill/fill.js @@ -25,6 +25,11 @@ class Fill extends Component { if ( ! this.occurrence ) { this.occurrence = ++occurrences; } + const { getSlot = noop } = this.context; + const slot = getSlot( this.props.name ); + if ( slot && ! slot.props.bubblesVirtually ) { + slot.forceUpdate(); + } } componentWillUnmount() { @@ -46,14 +51,6 @@ class Fill extends Component { } } - componentDidUpdate() { - const { getSlot = noop } = this.context; - const slot = getSlot( this.props.name ); - if ( slot && ! slot.props.bubblesVirtually ) { - slot.forceUpdate(); - } - } - resetOccurrence() { this.occurrence = null; }