Replies: 1 comment 1 reply
-
I think you are mostly correct and the documentation should probably be more clear. It has been a while since I looked at the code that handles From what I remember, the preview file is now statically analyzed to retrieve that function then it gets executed in an isolated context (I don't remember how it is executed exactly, but I think the idea is that you should consider it being run in an isolated purely javascript context. So, I don't think you should think of it as being in nodejs or a browser, but I am not 100% sure about that.) The change to how it is handled happened in v7 and the migration notes have a list of the limitations that should probably be mentioned in the documentation, also. Here is a link to the migration notes on the |
Beta Was this translation helpful? Give feedback.
-
Is
storySort
function executes on server, right?But preview is file originated for client side according documentation
I am confused that in this file is mix of client side and server side setup, so i cannot define base typescript sconfig for this file - Node based with access to path/filesystem or window/DOM.
So maybe
storySort
should be not inpreview
, but inmain
or separate file?My use case is following:
I have predefined
Record<string, string>
of top used stories and able to provide shortcut from command line argument and push this story to top of sorted stories to force this story be 1st on startup.Example, that is more complex in production:
yarn storybook --def=btn
Beta Was this translation helpful? Give feedback.
All reactions