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

Browser history broken #9614

Closed
more-v-kaple opened this issue Jan 23, 2020 · 2 comments
Closed

Browser history broken #9614

more-v-kaple opened this issue Jan 23, 2020 · 2 comments

Comments

@more-v-kaple
Copy link

Hey guys! Thank you for this product and contribution to its development.
Please, help me to figure out what I'm doing wrong or if such a feature is not supported, help with enhancing the functionality for the particular business case.

Issue details
Business case:
We have a page with search results. After user interaction with search filters, we make a new data fetch, update search results and add a new history record with current parameters and new URL search params.
If we use window.history.pushState(currentState, '', newQuery), the browser history works correctly, updating to previous/next state accordingly, but there's no reflection of the new URL query params.

If we use window.parent.history.pushState(currentState, '', newQuery) we can see the reflection in URL query params, but that breaks storybook and page renders blank with no errors in the console.

Is it possible to use history.pushState and have the correct work of browser history and URL updates at the same time?

Steps to reproduce
1)Go to page
Made a new history record with window.history.pushState(currentState, '', newQuery)
Notice, that URL wasn't changed.
Click back
URL stays the same, but browser history works properly.

2)Go to page
Made a new history record with window.parent.history.pushState(currentState, '', newQuery)
URL was changed.
Click back
URL was changed, but page was broken and rendered blank

Please specify which version of Storybook and optionally any affected add-ons that you're running
@storybook/addon-info: "5.3.8"
@storybook/addon-knobs: "5.3.8"
@storybook/addon-options: "5.3.8"
@storybook/addon-viewport: "5.3.8"
@storybook/react: "5.3.8"

Affected platforms
Noticed in Chrome 79.0.3945.130 for Windows 10.

@stale
Copy link

stale bot commented Feb 13, 2020

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Feb 13, 2020
@stale
Copy link

stale bot commented Mar 14, 2020

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants