diff --git a/packages/effect-fc/src/Component.ts b/packages/effect-fc/src/Component.ts index bc10ac6..a2f0d21 100644 --- a/packages/effect-fc/src/Component.ts +++ b/packages/effect-fc/src/Component.ts @@ -34,7 +34,7 @@ const ComponentProto = Object.freeze({ ...Effectable.CommitPrototype, [TypeId]: TypeId, - commit: Effect.fnUntraced(function*

(this: Component) { + commit: Effect.fn("Component")(function*

(this: Component) { const self = this const runtimeRef = React.useRef>>(null!) runtimeRef.current = yield* Effect.runtime>() @@ -77,6 +77,7 @@ const defaultOptions = { const nonReactiveTags = [Tracer.ParentSpan] as const + export const isComponent = (u: unknown): u is Component<{}, unknown, unknown> => Predicate.hasProperty(u, TypeId) export namespace make { @@ -377,6 +378,8 @@ export const withRuntime: { self: Component, context: React.Context>, ): React.FC

=> function WithRuntime(props) { - const runtime = React.useContext(context) - return React.createElement(Runtime.runSync(runtime)(self), props) + return React.createElement( + Runtime.runSync(React.useContext(context))(self), + props, + ) })