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 8c717cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/style.js
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() : null
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 8c717cc

Please sign in to comment.