-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
@storybook/server inlcude global parameters when requesting story to the server #13133
Comments
It looks like this would be easy to add. I can do it myself and open a PR. My only question would be what's the preferred naming of the query parameters.
If I'm not wrong, globals can be gotten from the storybook/app/server/src/client/preview/render.ts Lines 47 to 58 in a40349c
and they can be passed to fetchStoryHtml as a new fourth parameter.
|
I need to learn up on global args and toolbars. My first instinct would - Is it necessary to use globals vs just providing them as a regular parameter? This can be done at a high level and I think works with args etc. Second - If we use globals |
@jonspalmer In the story context we namespace these separately |
Another possibility is just passing the whole render context to the |
About global variables it's just a nice UX feature from Storybook that allows to move controls from the "Controls" section to the top toolbar. |
Yup what @santialbo said. @jonspalmer you can read more here: https://storybook.js.org/docs/react/essentials/toolbars-and-globals Basically the mechanism is very similar to args, except that it's global to Storybook and not specific to the story/component. |
Thanks for the great info. I can see the need to support this. My sense is we should do a few things:
export const parameters = {
server: {
url: `http://localhost:${port}/storybook_preview`,
globals: '*'
},
}; Options would be a "*", and Array of strings - acts as an allow list. We could also allow an object that acts as a allow list but also renames the params. Thoughts? |
I agree on 1 and 2. I went ahead and implemented a simple solution where I pass the context as fourth parameter in case someone might need it. If you prefer to just pass globals I'd be happy to update it. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.2.0-alpha.11 containing PR #13158 that references this issue. Upgrade today to the
|
I want to use storybook/server to show stories of emails generated with mjml.
Each of the emails has an English and a Spanish version and also an HTML and a text version. For this reason I created a couple globalTypes with the toolbar-addon.
However the selected values in these dropdowns are not passed as parameters to the rendering server.
Is there a way of passing these global parameters to the server as query parameters?
The text was updated successfully, but these errors were encountered: