Skip to content

Commit

Permalink
preeval registry at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Dec 20, 2021
1 parent c0b8639 commit f584ee5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { computeId } from './lib/hash'
const useInsertionEffect = React.useInsertionEffect || React.useLayoutEffect

const isBrowser = typeof window !== 'undefined'
const defaultRegistry = createStyleRegistry()
const defaultRegistry =
typeof window !== 'undefined' ? createStyleRegistry() : undefined
export default function JSXStyle(props) {
const registry = isBrowser ? defaultRegistry : useStyleRegistry()
const registry = defaultRegistry ? defaultRegistry : useStyleRegistry()

// If `registry` does not exist, we do nothing here.
if (!registry) {
Expand Down

0 comments on commit f584ee5

Please sign in to comment.