Skip to content

Commit 737f7c8

Browse files
committed
Update useFontsReady.ts
1 parent 6f26c52 commit 737f7c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/main/src/components/AnalyticalTable/hooks/useFontsReady.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { isSSR } from '../../../internal/utils.js';
33

44
// If reused, think about implementing the behavior via useSyncExternalStore
55

6+
const isClient = !isSSR() && document.fonts?.status === 'loaded';
7+
68
/**
79
* Hook that returns whether the fonts are loaded and ready to use.
810
*
911
* @returns boolean
1012
*/
1113
export function useFontsReady(): boolean {
12-
const [fontsReady, setFontsReady] = useState(false);
14+
const [fontsReady, setFontsReady] = useState(isClient && document.fonts?.status === 'loaded');
1315
useEffect(() => {
14-
if (isSSR() || !document.fonts) {
16+
if (!document.fonts) {
1517
return;
1618
}
1719

0 commit comments

Comments
 (0)