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";
11
11
import { HelmetProvider } from "react-helmet-async" ;
12
12
import themes from "theme" ;
13
13
import "theme/globalFonts" ;
14
+ import isChromatic from "chromatic/isChromatic" ;
14
15
15
16
DecoratorHelpers . initializeThemeState ( Object . keys ( themes ) , "dark" ) ;
16
17
@@ -102,3 +103,11 @@ function withQuery(Story, { parameters }) {
102
103
</ QueryClientProvider >
103
104
) ;
104
105
}
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