Skip to content

Commit eda061f

Browse files
committed
wip
1 parent 89107ac commit eda061f

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

packages/clerk-js/src/ui/styledSystem/StyleCacheProvider.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { StylisPlugin } from '@emotion/cache';
44
import createCache from '@emotion/cache';
55
// eslint-disable-next-line no-restricted-imports
66
import { CacheProvider } from '@emotion/react';
7-
import React, { useEffect, useMemo, useState } from 'react';
7+
import React, { useMemo } from 'react';
88

99
/**
1010
* A Stylis plugin that wraps CSS rules in a CSS layer
@@ -59,21 +59,16 @@ type StyleCacheProviderProps = React.PropsWithChildren<{
5959
* @returns A CacheProvider component with configured Emotion cache
6060
*/
6161
export const StyleCacheProvider = (props: StyleCacheProviderProps) => {
62-
const [insertionPoint, setInsertionPoint] = useState<HTMLElement | undefined>();
63-
64-
useEffect(() => {
65-
setInsertionPoint(getInsertionPoint());
66-
}, []);
67-
6862
const cache = useMemo(() => {
63+
const insertionPoint = getInsertionPoint();
6964
return createCache({
7065
key: 'cl-internal',
7166
prepend: !insertionPoint,
7267
insertionPoint: insertionPoint ?? undefined,
7368
nonce: props.nonce,
7469
stylisPlugins: props.cssLayerName ? [wrapInLayer(props.cssLayerName)] : undefined,
7570
});
76-
}, [props.nonce, props.cssLayerName, insertionPoint]);
71+
}, [props.nonce, props.cssLayerName]);
7772

7873
return <CacheProvider value={cache}>{props.children}</CacheProvider>;
7974
};

0 commit comments

Comments
 (0)