Skip to content
Snippets Groups Projects
Commit 50418f9f authored by esikkala's avatar esikkala
Browse files

Result table: improve browser back button handling

parent f488b867
No related branches found
No related tags found
No related merge requests found
...@@ -113,13 +113,15 @@ class ResultTable extends React.Component { ...@@ -113,13 +113,15 @@ class ResultTable extends React.Component {
this.props.updatePage(this.props.resultClass, 0); this.props.updatePage(this.props.resultClass, 0);
} }
} }
// handle browser's back button // handle browser's back button
const locationChanged = this.props.routeProps.location !== prevProps.routeProps.location; window.onpopstate = () => {
if (locationChanged) {
const qs = this.props.routeProps.location.search.replace('?', ''); const qs = this.props.routeProps.location.search.replace('?', '');
const newPage = parseInt(querystring.parse(qs).page); const newPage = parseInt(querystring.parse(qs).page);
this.props.updatePage(this.props.resultClass, newPage); if (newPage != this.props.data.page) {
} this.props.updatePage(this.props.resultClass, newPage);
}
};
} }
fetchResults = () => { fetchResults = () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment