Skip to content
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: browser navigating out after using back feature and going home #11833

Conversation

SlickDomique
Copy link
Contributor

Motivation

Fix for #11832

Before going to negative history index check if the history will return anything for that index. If that's not the case the previous behavior would open previously opened page from that tab.

Test plan

From my testing project you can test it by

To replicate the issue in my example open the app and do:

1. Open new tab and go to any page. After that manually put the app address to the address bar and navigate to it.
2. Navigate with menu to PageA
3. Navigate with menu to PageB
4. Use browser go back (can be button, keyboard shortcut or mouse button)
5. Navigate with menu to PageB again
6. Try navigating Home with menu
7. You will no longer get redirected to a previous page from step 0 but to the home page instead

Copy link

Hey @SlickDomique! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ad4be07) 74.19% compared to head (33af8e4) 74.19%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              6.x   #11833      +/-   ##
==========================================
- Coverage   74.19%   74.19%   -0.01%     
==========================================
  Files         178      178              
  Lines        5623     5626       +3     
  Branches     2216     2219       +3     
==========================================
+ Hits         4172     4174       +2     
- Misses       1402     1403       +1     
  Partials       49       49              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

haileyok added a commit to bluesky-social/social-app that referenced this pull request Feb 21, 2024
haileyok added a commit to bluesky-social/social-app that referenced this pull request Feb 22, 2024
@osdnk osdnk merged commit 7e5df55 into react-navigation:6.x Feb 23, 2024
8 checks passed
osdnk pushed a commit that referenced this pull request Feb 23, 2024
…11833)

**Motivation**

Fix for #11832

Before going to negative history index check if the history will return
anything for that index. If that's not the case the previous behavior
would open previously opened page from that tab.

**Test plan**

From my testing project you can test it by

To replicate the issue in my example open the app and do:

1. Open new tab and go to any page. After that manually put the app
address to the address bar and navigate to it.
    2. Navigate with menu to PageA
    3. Navigate with menu to PageB
4. Use browser go back (can be button, keyboard shortcut or mouse
button)
    5. Navigate with menu to PageB again
    6. Try navigating Home with menu
7. You will no longer get redirected to a previous page from step 0 but
to the home page instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants