Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(index): correct life cycles
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed Apr 11, 2019
1 parent 0a55846 commit 2d5ef46
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/react-instantsearch-core/src/components/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ class Index extends Component<Props, State> {
},
};

componentDidMount() {
this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(
this
);
constructor(props) {
super(props);

this.props.contextValue.onSearchParameters(
this.getSearchParameters.bind(this),
Expand All @@ -89,6 +87,12 @@ class Index extends Component<Props, State> {
);
}

componentDidMount() {
this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(
this
);
}

componentWillReceiveProps(nextProps: Props) {
if (this.props.indexName !== nextProps.indexName) {
this.props.contextValue.widgetsManager.update();
Expand Down

0 comments on commit 2d5ef46

Please sign in to comment.