-
-
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
Change ClientApi
to be a facade in front of the store
#16006
Change ClientApi
to be a facade in front of the store
#16006
Conversation
Nx Cloud ReportWe didn't find any information for the current pull request with the commit 6e6f0ef. Check the Nx Cloud Github Integration documentation for more information. Sent with 💌 from NxCloud. |
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.
We still need to add story sorting to the index server, right?
const clientApi = new ClientApi(); | ||
let data; | ||
|
||
clientApi.setAddon({ |
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.
let's deprecate and remove in 7.0?
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.
Good idea, want to open a ticket for it?
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.
Yes we do. I think @bebraw has prototyped it over in the skeleton. |
Yup, I have a basic implementation in place there at tmeasday/storybook-skeleton#28 . |
Merged as part of #15871 |
Part of #15871
Telescoping on #16005
What I did
Change the behaviour of the v6 APIs/entrypoints to use the on-demand store in a pre-loaded (i.e. not on-demand) way.
Change the
@storybook/client-api
API exports (which are re-exported by the various app layers) to be a "facade" in front of the story store. What this means is:addDecorators()
& friends are collected on the Client API, and passed to aWebPreview
as agetProjectAnnotations
function.storiesOf()
are are collected, and massaged into a "CSF import" that is then supplied as a (synchronous)importFn
.add()
are similarly added to the CSF imports, and also indexed into to be passed as a (synchronous)fetchStoryIndex
function. Note this function implements story sorting in the preview[1]Similarly, if a
Loadable
is passed to theconfigure()
function (like arequire.context
), its exports (CSF exports) are collected by theClientApi
in a similar way to the above.When the
start()
function (called by all e.g.@storybook/react
entry points) is called it creates the above and a webpreview, which itinitialize()
s synchronously -- which means all stories are loaded right away.[1] In the v7 store the story sorting of the index happens in node.