Skip to content

Commit 8cfe9a6

Browse files
Scheduler - Fix incorrect appointment layout on initial Storybook render (DevExpress#33311)
1 parent 7da134d commit 8cfe9a6

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

apps/react-storybook/.storybook/themes/themes.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ export const compact = [
3434

3535
export const ThemeDecorator: Decorator = (Story, ctx) => {
3636
const { theme, compact } = ctx.globals;
37+
const [cssLoaded, setCssLoaded] = React.useState(false);
3738
const themeName = theme.split('.').length < 3 ? 'generic' : theme.split('.')[0];
3839
const cssFileHref = `css/dx.${theme}${compact ? '.compact' : ''}.css`
3940
return (
40-
<div className={`dx-theme-${themeName}-typography storybook-theme-decorator`}>
41-
<link rel="stylesheet" href={cssFileHref} />
42-
<Story />
41+
<div key={cssFileHref} className={`dx-theme-${themeName}-typography storybook-theme-decorator`}>
42+
<link
43+
rel="stylesheet"
44+
href={cssFileHref}
45+
onLoad={() => setCssLoaded(true)}
46+
onError={() => setCssLoaded(true)}
47+
/>
48+
{cssLoaded && <Story />}
4349
</div>
4450
);
4551
}

0 commit comments

Comments
 (0)