Describe the bug
The configured background only seems to 'appear' when I'm resizing the window.
Expected behavior
I expect the backgrounds add on to show the background that I've set as default in config.js
Screenshots
https://gyazo.com/692513518902f8e403036d29b4ee5c28
Code snippets
addParameters({
backgrounds: [
{ name: "E3 Darker Orange", value: "#F15C29", default: true}
]
})
System:
"@storybook/addon-actions": "^5.0.11",
"@storybook/addon-backgrounds": "^5.0.11",
"@storybook/addon-links": "^5.0.11",
"@storybook/addons": "^5.0.11",
"@storybook/react": "^5.0.11",
"react": "^16.8.6",
"react-dom": "^16.8.6",
Additional context
Add any other context about the problem here.
I have the same issue setting backgrounds in .storybook/config.js in a TypeScript project. However, the background is not showing even when resizing the window.
It works fine when adding background parameters to individual stories.
I solved this for myself by calling addParameters before configure.
I solved this for myself by calling
addParametersbeforeconfigure.
Will try this later
Thanks, that works. Should probably be mentioned in the documentation? Currently it just says "You can add the backgrounds to all stories with addParameters in .storybook/config.js".
If @KadenLNelson could confirm that this solves their issue we can close this.
This is indicative of a bug:
Global decorators and parameters must currently be set BEFORE the configure call.
I solved this for myself by calling
addParametersbeforeconfigure.Will try this later
This did not work
example:
addDecorator(withKnobs);
addDecorator(withInfo);
// add backgrounds and viewports
addParameters({
backgrounds: [
{ name: "Black", value: "#888888", default: true}
],
viewport: {
viewports: {
...INITIAL_VIEWPORTS,
...newViewports
}
}
})
// configure storybook
configure(loadStories, module);
Backgrounds has been overhauled in 6.0 and works properly now https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#backgrounds-addon-has-a-new-api
Most helpful comment
This did not work
example: