diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index fbb33c4..2b0c5f6 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -68,8 +68,13 @@ export const useFC: { const runtimeRef = React.useRef>>(null!) runtimeRef.current = yield* Effect.runtime>() - return React.useMemo(() => function ScopeProvider(props: P) { - const scope = Runtime.runSync(runtimeRef.current)(Hook.useScope([], self.options)) + return React.useCallback(function ScopeProvider(props: P) { + const scope = Runtime.runSync(runtimeRef.current)(Hook.useScope( + Array.from( + Context.omit(...nonReactiveTags)(runtimeRef.current.context).unsafeMap.values() + ), + self.options, + )) const FC = React.useMemo(() => { const f = (props: P) => Runtime.runSync(runtimeRef.current)( @@ -80,9 +85,7 @@ export const useFC: { }, [scope]) return React.createElement(FC, props) - }, Array.from( - Context.omit(...nonReactiveTags)(runtimeRef.current.context).unsafeMap.values() - )) + }, []) }) export const useSuspenseFC: {