etchteam/storybook-addon-css-variables-theme

cookie does not update globals on first pageload

Closed this issue · 1 comments

if there is a cookie set with a certain value xyz but the default is abc on first load of the page the globals are not set yet and thus fallback to the default value of abc although the cookie is xyz and dropdown shows it.

you trigger the custom event with the correct value but do not update the globals before passing the everything to the story which leads to context.globals.cssVariables having the wrong value.

I'm no storybook expert and only briefly looked at the plugin-code, but this is how I made it work for the "old" version that was still using the storybook v7 setup: pkyeck@9e78412

BTW: I don't know if the new setup is backwards compatible, but maybe making the 2.1.0 a major update and use 3.0.0 would have made more sense. People would not automatically get the new version if the have ^2.0.6 in their package.json