Fix
All checks were successful
Lint / lint (push) Successful in 15s

This commit is contained in:
Julien Valverdé
2025-07-23 17:36:26 +02:00
parent dcb6cf30b2
commit 8d393a85e9

View File

@@ -34,7 +34,7 @@ const ComponentProto = Object.freeze({
...Effectable.CommitPrototype, ...Effectable.CommitPrototype,
[TypeId]: TypeId, [TypeId]: TypeId,
commit: Effect.fnUntraced(function* <P extends {}, E, R>(this: Component<P, E, R>) { commit: Effect.fn("Component")(function* <P extends {}, E, R>(this: Component<P, E, R>) {
const self = this const self = this
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>>()
@@ -77,6 +77,7 @@ const defaultOptions = {
const nonReactiveTags = [Tracer.ParentSpan] as const const nonReactiveTags = [Tracer.ParentSpan] as const
export const isComponent = (u: unknown): u is Component<{}, unknown, unknown> => Predicate.hasProperty(u, TypeId) export const isComponent = (u: unknown): u is Component<{}, unknown, unknown> => Predicate.hasProperty(u, TypeId)
export namespace make { export namespace make {
@@ -377,6 +378,8 @@ export const withRuntime: {
self: Component<P, E, R>, self: Component<P, E, R>,
context: React.Context<Runtime.Runtime<R>>, context: React.Context<Runtime.Runtime<R>>,
): React.FC<P> => function WithRuntime(props) { ): React.FC<P> => function WithRuntime(props) {
const runtime = React.useContext(context) return React.createElement(
return React.createElement(Runtime.runSync(runtime)(self), props) Runtime.runSync(React.useContext(context))(self),
props,
)
}) })