New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: bug with out of sync index in createMemoryHistory #11509
base: main
Are you sure you want to change the base?
fix: bug with out of sync index in createMemoryHistory #11509
Conversation
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
c85f217
to
90c8f45
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #11509 +/- ##
==========================================
- Coverage 75.72% 75.16% -0.56%
==========================================
Files 198 190 -8
Lines 5795 5747 -48
Branches 2268 2263 -5
==========================================
- Hits 4388 4320 -68
- Misses 1360 1380 +20
Partials 47 47
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Can you add a test for this under example/e2e/tests
?
Please provide enough information so that others can review your pull request.
Motivation
The index in
createMemoryHistory
may be out of sync and that causes the items array to drop entries in some cases.Test plan
In example app, add this.log in onPopState callback, push many screens in simple stack, end up on Article screen, do one go back and one forward actions with browser buttons, click POP SCREEN . You will end up in the initial page instead of the previous screen you were at.
example.mov
The change must pass lint, typescript and tests.
Note
I've added a commit to log
createMemoryHistory
items to make it easier to see what's actually going on. It can be removed before merging.To see the logs you have to uncomment the line 238 in
createMemoryHistory