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 {
this.props.updatePage(this.props.resultClass, 0);
}
}
// handle browser's back button
const locationChanged = this.props.routeProps.location !== prevProps.routeProps.location;
if (locationChanged) {
window.onpopstate = () => {
const qs = this.props.routeProps.location.search.replace('?', '');
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 = () => {
......
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