Skip to content

Commit 9717107

Browse files
committed
useInsertionEffect directly in Global
1 parent ab928db commit 9717107

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/react/src/global.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import * as React from 'react'
1+
import React from 'react'
22
import isDevelopment from '#is-development'
33
import { withEmotionCache } from './context'
44
import { Theme, ThemeContext } from './theming'
55
import { insertStyles } from '@emotion/utils'
66
import { Options as SheetOptions, StyleSheet } from '@emotion/sheet'
77
import isBrowser from '#is-browser'
8-
import { useInsertionEffectWithLayoutFallback } from '@emotion/use-insertion-effect-with-fallbacks'
98

109
import { Interpolation, serializeStyles } from '@emotion/serialize'
1110

@@ -86,7 +85,7 @@ export let Global = /* #__PURE__ */ withEmotionCache<GlobalProps>(
8685
[sheet: StyleSheet, isRehydrating: boolean] | undefined
8786
>(undefined)
8887

89-
useInsertionEffectWithLayoutFallback(() => {
88+
React.useInsertionEffect(() => {
9089
const key = `${cache.key}-global`
9190

9291
// use case of https://github.com/emotion-js/emotion/issues/2675
@@ -117,7 +116,7 @@ export let Global = /* #__PURE__ */ withEmotionCache<GlobalProps>(
117116
}
118117
}, [cache])
119118

120-
useInsertionEffectWithLayoutFallback(() => {
119+
React.useInsertionEffect(() => {
121120
let sheetRefCurrent = sheetRef.current!
122121
let [sheet, rehydrating] = sheetRefCurrent
123122
if (rehydrating) {

0 commit comments

Comments
 (0)