Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v5.x
Current Behavior
If you have 3 pages A, B and C
You go from A -> B with a stateB and then B -> C with stateC the app may crash because when you are on page C, B is mounted and the stateB that returns the useLocation hook, will have the stateC value because you are no longer on B
This is a silly example of an app crashing with this:
https://codesandbox.io/s/holy-waterfall-t9ofg1?file=/src/pages/UserDetailPage/UserDetailPage.tsx
Expected Behavior
Each page should have their useLocation not muting with the new state.
I know that this is not a bug per se, but a bad interaction between useLocation and Ionic with mounted pages.
But is something that needs to be cared about and or offer a solution, or clariy in the documentation
Steps to Reproduce
Easy example:
1 -Click in any User
2 - Then click on More details button
3 - app break
https://codesandbox.io/s/holy-waterfall-t9ofg1?file=/src/pages/UserDetailPage/UserDetailPage.tsx
Code Reproduction URL
https://codesandbox.io/s/holy-waterfall-t9ofg1?file=/src/pages/UserDetailPage/UserDetailPage.tsx
Ionic Info
Ionic:
Ionic CLI
Ionic Framework : @ionic/react 5.9.1
Capacitor:
Capacitor CLI : 4.1.0
@capacitor/android : 4.1.0
@capacitor/core : 4.1.0
@capacitor/ios : 4.1.0
Utility:
cordova-res : 0.15.1
native-run : 1.7.0
System:
NodeJS : v14.17.0
npm : 6.14.13
OS : Windows 10
Additional Information
No response