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

Save local state in sessionStorage or shared state #274

Merged

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Mar 27, 2024

When switching to a docs page, addons don't render and thus the VTA addon is destroyed, losing all internal React state. By synchronizing local state with sessionStorage, this problem is circumvented.

📦 Published PR as canary version: 1.3.0--canary.274.0843e22.0

✨ Test out this PR locally via:

npm install @chromatic-com/storybook@1.3.0--canary.274.0843e22.0
# or 
yarn add @chromatic-com/storybook@1.3.0--canary.274.0843e22.0

@ghengeveld ghengeveld added release Auto: Create a `latest` release when merged patch Auto: Increment the patch version when merged labels Mar 27, 2024
@ghengeveld ghengeveld changed the title Sync local state with sessionStorage to avoid losing it when addon is closed Save local state in sessionStorage Mar 27, 2024
@ghengeveld ghengeveld linked an issue Mar 27, 2024 that may be closed by this pull request
@ghengeveld ghengeveld removed the request for review from yannbf March 27, 2024 14:03
@ghengeveld ghengeveld changed the title Save local state in sessionStorage Save local state in sessionStorage or shared state Mar 28, 2024
@ghengeveld ghengeveld merged commit cc362bf into main Apr 4, 2024
8 checks passed
@ghengeveld ghengeveld deleted the ghengeveld/273-state-is-lost-when-switching-to-docs-page branch April 4, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Auto: Increment the patch version when merged release Auto: Create a `latest` release when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

State is lost when switching to docs page
3 participants