This commit is contained in:
@@ -5,6 +5,7 @@ import * as ReactHook from "./ReactHook.js"
|
|||||||
|
|
||||||
export interface ReactComponent<P, E, R> {
|
export interface ReactComponent<P, E, R> {
|
||||||
(props: P): Effect.Effect<React.ReactNode, E, R>
|
(props: P): Effect.Effect<React.ReactNode, E, R>
|
||||||
|
readonly displayName?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const nonReactiveTags = [Tracer.ParentSpan] as const
|
export const nonReactiveTags = [Tracer.ParentSpan] as const
|
||||||
@@ -21,7 +22,9 @@ export const useFC: {
|
|||||||
const runtime = yield* Effect.runtime<R>()
|
const runtime = yield* Effect.runtime<R>()
|
||||||
|
|
||||||
return React.useMemo(() => {
|
return React.useMemo(() => {
|
||||||
return (props: P) => Runtime.runSync(runtime)(self(props))
|
const FC = (props: P) => Runtime.runSync(runtime)(self(props))
|
||||||
|
if (self.displayName) FC.displayName = self.displayName
|
||||||
|
return FC
|
||||||
}, Array.from(
|
}, Array.from(
|
||||||
Context.omit(...nonReactiveTags)(runtime.context).unsafeMap.values()
|
Context.omit(...nonReactiveTags)(runtime.context).unsafeMap.values()
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user