ionic-framework
ionic-framework copied to clipboard
bug: redundant rerender when switch router
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- [ ] v4.x
- [ ] v5.x
- [ ] v6.x
- [X] Nightly
Current Behavior
When switching the router between two pages, both page components will rerender 4 times.
Expected Behavior
When switching the router between two pages, the target page should only render 1 time. The old page should not be rerendered.
Steps to Reproduce
- Go to https://codesandbox.io/s/ionic-react-rerender-5vf2lj
- Click the "Brew" tab
- then switch to the "Settings" tab
- You will see the "render Brew" and "render Settings" log will print 4 times each
Code Reproduction URL
https://codesandbox.io/s/ionic-react-rerender-5vf2lj
Ionic Info
Because the repro is in codesandbox, I cannot run ionic info.
"@ionic/react": "6.2.8-nightly.20220915",
"@ionic/react-router": "6.2.8-nightly.20220915",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
Additional Information
Maybe duplicated with https://github.com/ionic-team/ionic-framework/issues/22426 and https://github.com/ionic-team/ionic-framework/issues/24107, but those issue is still not fixed even in the latest release version. so I created this new issue.