-
-
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
📜[storysource] 📦 [sandpack] The clientApi must be reused when possible #6154
Conversation
Hi @shilman @tmeasday and @ndelangen. I think I spoke about it with you, but don't hesitate to discuss about the intent if you don't agree. |
Codecov Report
@@ Coverage Diff @@
## next #6154 +/- ##
==========================================
+ Coverage 38.04% 38.06% +0.01%
==========================================
Files 643 643
Lines 9420 9423 +3
Branches 1373 1345 -28
==========================================
+ Hits 3584 3587 +3
Misses 5268 5268
Partials 568 568
Continue to review full report at Codecov.
|
const storyStore = new StoryStore({ channel }); | ||
const clientApi = new ClientApi({ storyStore, decorateStory }); | ||
let storyStore; | ||
let clientApi; |
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.
any way to make that const again ?
I know that Kotlin can do it. (free ad)
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'd wrap it into a function, that way the result of the function can be a const
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.
LGTM
thanks |
Issue:
What I did
I am working on a topic : ability to live edit the story when on the screen, and ability to export the component as a project in codesandbox.
This will be done by upgrading the storysource addon, which could become an Integrated Development Environment
Sandpack will re-download storybook.
Then we must have an idempotent behavior, which means keeping control over code run several times.
In this case, we must prevent the clientApi from being created twice, instead we must reuse the currently existing one.
How to test
Is this testable with Jest or Chromatic screenshots?
I added one test to verify that it works.
Does this need a new example in the kitchen sink apps?
I don't think so.
Does this need an update to the documentation?
I don't think so.
If your answer is yes to any of these, please make sure to include it in your PR.