We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f26c52 commit 737f7c8Copy full SHA for 737f7c8
packages/main/src/components/AnalyticalTable/hooks/useFontsReady.ts
@@ -3,15 +3,17 @@ import { isSSR } from '../../../internal/utils.js';
3
4
// If reused, think about implementing the behavior via useSyncExternalStore
5
6
+const isClient = !isSSR() && document.fonts?.status === 'loaded';
7
+
8
/**
9
* Hook that returns whether the fonts are loaded and ready to use.
10
*
11
* @returns boolean
12
*/
13
export function useFontsReady(): boolean {
- const [fontsReady, setFontsReady] = useState(false);
14
+ const [fontsReady, setFontsReady] = useState(isClient && document.fonts?.status === 'loaded');
15
useEffect(() => {
- if (isSSR() || !document.fonts) {
16
+ if (!document.fonts) {
17
return;
18
}
19
0 commit comments