From 37d9400adad9ad10e29e6934f1a127e03af33b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 30 Jun 2025 00:37:16 +0200 Subject: [PATCH] Component displayName --- packages/effect-components/src/ReactComponent.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/effect-components/src/ReactComponent.ts b/packages/effect-components/src/ReactComponent.ts index adca7c7..e20f4a0 100644 --- a/packages/effect-components/src/ReactComponent.ts +++ b/packages/effect-components/src/ReactComponent.ts @@ -5,6 +5,7 @@ import * as ReactHook from "./ReactHook.js" export interface ReactComponent { (props: P): Effect.Effect + readonly displayName?: string } export const nonReactiveTags = [Tracer.ParentSpan] as const @@ -21,7 +22,9 @@ export const useFC: { const runtime = yield* Effect.runtime() 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( Context.omit(...nonReactiveTags)(runtime.context).unsafeMap.values() ))