File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { QueryClient, QueryClientProvider } from "react-query";
1111import { HelmetProvider } from "react-helmet-async" ;
1212import themes from "theme" ;
1313import "theme/globalFonts" ;
14+ import isChromatic from "chromatic/isChromatic" ;
1415
1516DecoratorHelpers . initializeThemeState ( Object . keys ( themes ) , "dark" ) ;
1617
@@ -102,3 +103,11 @@ function withQuery(Story, { parameters }) {
102103 </ QueryClientProvider >
103104 ) ;
104105}
106+
107+ // Try to fix storybook rendering fonts inconsistently
108+ // https://www.chromatic.com/docs/font-loading/#solution-c-check-fonts-have-loaded-in-a-loader
109+ const fontLoader = async ( ) => ( {
110+ fonts : await document . fonts . ready ,
111+ } ) ;
112+
113+ export const loaders = isChromatic ( ) && document . fonts ? [ fontLoader ] : [ ] ;
You can’t perform that action at this time.
0 commit comments