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

feat: store panel open state in storage #641

Merged
merged 5 commits into from
Nov 23, 2024

Conversation

tlow92
Copy link
Contributor

@tlow92 tlow92 commented Nov 2, 2024

Issue:

In my team we often don't use the addons panel actively, but it opens again everytime you refresh storybook in web.

What I did

I reused the storage solution from lastViewedStoryIds which leverages store2 and store the addons panel and sidebar open state in storage.

@tlow92 tlow92 requested a review from dannyhw as a code owner November 2, 2024 21:35
@@ -0,0 +1,12 @@
import { useEffect, useState } from 'react';
import store from 'store2';
Copy link
Member

@dannyhw dannyhw Nov 7, 2024

Choose a reason for hiding this comment

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

I don't think this store actually works, I'm realising now that its in the lastViewed hook but I think its just an artifact from me copy/pasting a bit too freely from the web code 😅

We have the storage from the getStorybookUI thats required maybe we can pass that down to the ui

Edit:

Wait i guess if this is for web only that would work 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's only web, but I can take a look at the other storage solution and migrate to that so maybe we can drop store2 usage later alltogether.

Copy link
Member

Choose a reason for hiding this comment

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

yeah the thing is that we also want tablets and other wide screen devices to work so that would be ideal

@dannyhw
Copy link
Member

dannyhw commented Nov 19, 2024

@tlow92 I had a go at adjusting it to use the user provided storage, let me know what you think of this solution

@tlow92
Copy link
Contributor Author

tlow92 commented Nov 21, 2024

@dannyhw Only checked code right now, but looks good to me! 👍 This is much cleaner I think

@dannyhw dannyhw merged commit 55ef108 into storybookjs:next Nov 23, 2024
1 check passed
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.

2 participants