Replies: 1 comment
-
As far as I can tell, this it the entry point for the manager: https://github.com/storybookjs/storybook/blob/next/code/ui/manager/src/index.tsx I do not see a export const Root: FC<RootProps> = ({ provider, styleCache }) => (
<CacheProvider value={styleCache}>
<HelmetProvider key="helmet.Provider">
<LocationProvider key="location.provider">
<Main provider={provider} />
</LocationProvider>
</HelmetProvider>
</CacheProvider>
);
export function renderStorybookUI(domNode: HTMLElement, provider: Provider) {
if (!(provider instanceof Provider)) {
throw new Error('provider is not extended from the base Provider');
}
const styleCache = createCache(provider.styleCacheOptions)
ReactDOM.render(<Root key="root" provider={provider} styleCache={styleCache} />, domNode);
} Somehow, the value of Maybe there is a better way to inject the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're using storybook for preact demos and webpack bundles @emotion/core -> @emotion/cache -> @emotion/sheet which is inserting styles to iframe headers causing multiple CSP errors for styles like below
I tried checking the following docs - https://emotion.sh/docs/cache-provider, https://www.npmjs.com/package/@emotion/sheet/v/10.0.0-really-unsafe-please-do-not-use.1?activeTab=dependents to pass the nonce but we do not create StyleSheet / createCache within any component, but webpack bundles all dependencies from package.json as a part of theme and it applies default options ( nonce - undefined)
I tried adding CacheProvider to storybook decorators globally like below - ( https://storybook.js.org/docs/react/writing-stories/decorators )
I can see cache-block is rendered but the header styles are not updated with the nonce value.
If I miss anything here or if there's another way to pass nonce for emotion-styles please let me know!
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions