Skip to content

Commit

Permalink
Listen to window’s popstate events for QS changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnmoon committed Oct 28, 2019
1 parent 66f8ec4 commit 3671d1d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/search/instant-search/components/search-app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class SearchApp extends Component {
this.input.current.focus();
}

window.addEventListener( 'popstate', this.onChangeQueryString );
window.addEventListener( 'queryStringChange', this.onChangeQueryString );
}
componentWillUnmount() {
window.removeEventListener( 'popstate', this.onChangeQueryString );
window.removeEventListener( 'queryStringChange', this.onChangeQueryString );
}

Expand Down

0 comments on commit 3671d1d

Please sign in to comment.