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: keep hash/fragment section for initial render #11078

Merged
merged 1 commit into from Dec 7, 2022
Merged

fix: keep hash/fragment section for initial render #11078

merged 1 commit into from Dec 7, 2022

Conversation

nikgraf
Copy link
Contributor

@nikgraf nikgraf commented Dec 6, 2022

Motivation

Fixes this issue that I discovered #11026

Test plan

  1. Run the example
  2. Visit http://localhost:19006/simple-stack/article/gandalf#test
  3. The with #test part still exists
  4. Note that if you change the hash it will be gone (this is expected)

@netlify
Copy link

netlify bot commented Dec 6, 2022

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit e588bc0
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/638f6014fdc29200099bbf3c
😎 Deploy Preview https://deploy-preview-11078--react-navigation-example.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@satya164 satya164 left a 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. I think we should also preserve the hash on URL updates (if the screen didn't change). For now, we could only check if the path didn't change and preserve the hash.

Can you move this logic to history.replace function where it preserves the hash if path is the same?

@nikgraf
Copy link
Contributor Author

nikgraf commented Dec 6, 2022

@satya164 force pushed a fix that works no as you described and in History.replace

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@satya164 satya164 merged commit 31cb2a2 into react-navigation:main Dec 7, 2022
satya164 pushed a commit that referenced this pull request Dec 11, 2022
**Motivation**

Fixes this issue that I discovered
#11026

**Test plan**

1. Run the example
2. Visit http://localhost:19006/simple-stack/article/gandalf#test
3. The with #test part still exists
4. Note that if you change the hash it will be gone (this is expected)
satya164 pushed a commit that referenced this pull request Feb 17, 2023
**Motivation**

Fixes this issue that I discovered
#11026

**Test plan**

1. Run the example
2. Visit http://localhost:19006/simple-stack/article/gandalf#test
3. The with #test part still exists
4. Note that if you change the hash it will be gone (this is expected)
satya164 pushed a commit that referenced this pull request Feb 17, 2023
**Motivation**

Fixes this issue that I discovered
#11026

**Test plan**

1. Run the example
2. Visit http://localhost:19006/simple-stack/article/gandalf#test
3. The with #test part still exists
4. Note that if you change the hash it will be gone (this is expected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants