0.1.0 #1
@@ -68,8 +68,13 @@ export const useFC: {
|
|||||||
const runtimeRef = React.useRef<Runtime.Runtime<Exclude<R, Scope.Scope>>>(null!)
|
const runtimeRef = React.useRef<Runtime.Runtime<Exclude<R, Scope.Scope>>>(null!)
|
||||||
runtimeRef.current = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
|
runtimeRef.current = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
|
||||||
|
|
||||||
return React.useMemo(() => function ScopeProvider(props: P) {
|
return React.useCallback(function ScopeProvider(props: P) {
|
||||||
const scope = Runtime.runSync(runtimeRef.current)(Hook.useScope([], self.options))
|
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 FC = React.useMemo(() => {
|
||||||
const f = (props: P) => Runtime.runSync(runtimeRef.current)(
|
const f = (props: P) => Runtime.runSync(runtimeRef.current)(
|
||||||
@@ -80,9 +85,7 @@ export const useFC: {
|
|||||||
}, [scope])
|
}, [scope])
|
||||||
|
|
||||||
return React.createElement(FC, props)
|
return React.createElement(FC, props)
|
||||||
}, Array.from(
|
}, [])
|
||||||
Context.omit(...nonReactiveTags)(runtimeRef.current.context).unsafeMap.values()
|
|
||||||
))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export const useSuspenseFC: {
|
export const useSuspenseFC: {
|
||||||
|
|||||||
Reference in New Issue
Block a user