Skip to content

Commit

Permalink
Merge pull request #4349 from WordPress/fix/3839-undelayed-slot-prop-…
Browse files Browse the repository at this point in the history
…update

fix/3839: Move slot.forceUpdate() to fill's render to fix prop propagation
  • Loading branch information
mcsf committed Jan 19, 2018
2 parents 62a9e7b + 9da45da commit d967017
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions components/slot-fill/fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
}
Expand Down

0 comments on commit d967017

Please sign in to comment.