Permalink
Browse files

Merge pull request #4349 from WordPress/fix/3839-undelayed-slot-prop-…

…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 d967017d528040df234dde882c2ea2419203d55d
Showing with 5 additions and 8 deletions.
  1. +5 −8 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;
}

0 comments on commit d967017

Please sign in to comment.