From 8c717cce939ead6c47cfa99635cf6f4fcbd4b637 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Mon, 20 Dec 2021 16:12:42 +0100 Subject: [PATCH] preeval registry at top level --- src/style.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/style.js b/src/style.js index 405498ff..b32f43a4 100644 --- a/src/style.js +++ b/src/style.js @@ -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) {