Skip to content

Commit

Permalink
issue/#287 (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
illiakovalenko committed May 15, 2020
1 parent f6a939c commit 4829151
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ export class SitecoreContext extends React.Component<SitecoreContextProps> {

// we force the children of the context to re-render when the context is updated
// even if the local props are unchanged; we assume the contents depend on the Sitecore context
this.contextFactory.subscribeToContext(() => this.forceUpdate());
this.contextFactory.subscribeToContext(this.contextListener);
}

contextListener = () => this.forceUpdate();

componentWillUnmount() {
this.contextFactory.unsubscribeFromContext(this.contextListener);
}

render() {
Expand Down

0 comments on commit 4829151

Please sign in to comment.