Do not set prevPath if navigation passes through skipSavingPath flag

This commit is contained in:
Andrew Nicolaou 2019-08-24 13:28:21 +02:00
parent 443232380c
commit 1b461d33cf

View file

@ -18,7 +18,10 @@ class App extends React.Component {
}
componentWillReceiveProps(nextProps) {
if (nextProps.location !== this.props.location) {
const locationWillChange = nextProps.location !== this.props.location;
const shouldSkipRemembering = nextProps.location.state && nextProps.location.state.skipSavingPath === true;
if (locationWillChange && !shouldSkipRemembering) {
this.props.setPreviousPath(this.props.location.pathname);
}
}