-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Core: Single story option in iframe view #14875
Conversation
Nx Cloud ReportCI ran the following commands for commit 69880ed. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
@robhil Some news:
I'll merge this as soon as CI passes and release in the next alpha. Great work! 🎉 |
@tmeasday any ideas for a cleaner way to implement this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great idea and it is a pretty great implementation, thank you for the tests.
However I think I agree with what @shilman is hinting at here and that we should do this filtering in the store. It knows about the specifier already, so could it not just make addStory()/addKindMetadata()
a no-op when the kind/storyId doesn't match? WDYT?
We have to evaluate (i.e require) all the imports anyway in this implementation so I would imagine that iterating through them and performing a no-op for each one wouldn't have a performance cost, but if that's not the case, we could reconsider.
I am planning on totally overhauling the story store sometime soon (probably not for 6.3 though), so I am not precious about how this is implemented, but putting it in store at least means it would also work for non-CSF stories too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thank you
We are trying to integrate the Storybook in our app - UXPin and allow our users to use components from Storybook in their design.
Generally, it's work fine but we noticed that the iframe view loads slower when there are more stories added to the storybook
e.g. please take into consideration this button: https://5ccbc373887ca40020446347-synmdrrwjj.chromatic.com/iframe.html?id=design-system-button--basic&viewMode=story
ConfigApi.configure takes about 900ms.
What I did
We figured out that we can load only one story when we want to show only one component.
We added a new param __singleStory and when it's true only one story is loaded.
As I know you have some plans to improve the loading time but this solution could be a quick win for us :)
Here you can see how it looks tested on official-storybook example
https://recordit.co/dkie0lFbJk
How to test
no
no
no