Skip to content

Commit

Permalink
fix(react): unmount leaving view when using browser back button, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elylucas committed Oct 29, 2019
1 parent f70e71a commit 2dc5540
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-router/src/ReactRouter/Router.tsx
Expand Up @@ -100,11 +100,13 @@ class RouteManager extends React.Component<RouteComponentProps, RouteManagerStat
* record the view that originally directed to the new view for back button purposes.
*/
enteringView.prevId = enteringView.prevId || leavingView.id;
} else if (action === 'POP') {
direction = leavingView.prevId === enteringView.id ? 'back' : 'none';
} else {
direction = direction || 'back';
leavingView.mount = false;
}
} else if (action === 'REPLACE') {
} else if (direction === 'back' || action === 'REPLACE') {
leavingView.mount = false;
}
} else {
Expand Down

0 comments on commit 2dc5540

Please sign in to comment.