expo
expo copied to clipboard
[Expo Router V3] Fix route pushing
Why
Was still having issues with pushing even after v3 latest changes, where router.push() was still performing as router.pushOrPop().
How
When users directly use router.push() the route should be pushed - it shouldn't go back down through all the states and pop the last state, it should just push to the stack.
Test Plan
Verify when router.push() is used, that the new route is always pushed to the stack.
Checklist
- [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
- [ ] Conforms with the Documentation Writing Style Guide
- [ ] This diff will work correctly for
npx expo prebuild
& EAS Build (eg: updated a module plugin).
Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.
I've found some issues in your pull request that should be addressed (click on them for more details) 👇
⚠️ Suggestion: Missing links in changelog entries
I've added some suggestions below, you can just apply and commit them 😉
Generated by ExpoBot 🤖 against 818630862a72907d54cc83f1b31c719a4756b567
@marklawlor I believe the latest commit https://github.com/expo/expo/pull/26597/commits/f2a0c2f0628f714a34b68312c0361f0faa985ded should fix the issues. I'm not quite sure how to write a test case exactly for this issue as it depends on when the route is updaing and when useEffect fires to grab new data.
It now will push the state if route params change too. It still retains checking if the routes are exactly equal and will not push if so.
The issue still occurs with url queries ie /path/to/route?query=test. Route still doesn't push when the url query param changes. Has something to do with the parent state nesting params, where the new param shows in the nested, but not in the main object..
For example, sometimes it will appear like this
currentRoute.params = {
path:'a',
to:'b',
route:'c',
params: {
path:'a',
to:'b',
route:'c',
query:'test'
}
}