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

This commit is contained in:
Julien Valverdé
2025-07-01 16:16:29 +02:00
parent bb1a71f63b
commit 02ee2c10cc
2 changed files with 4 additions and 4 deletions

View File

@@ -25,11 +25,11 @@ export const withDisplayName: {
export const useFC: {
<E, R, P extends {} = {}>(
self: ReactComponent<E, R, P>
): Effect.Effect<React.FC<P>, never, R>
): Effect.Effect<React.FC<P>, never, Exclude<R, Scope.Scope>>
} = Effect.fnUntraced(function* <E, R, P extends {}>(
self: ReactComponent<E, R, P>
) {
const runtime = yield* Effect.runtime<R>()
const runtime = yield* Effect.runtime<Exclude<R, Scope.Scope>>()
return React.useMemo(() => function ScopeProvider(props: P) {
const scope = Runtime.runSync(runtime)(ReactHook.useScope())
@@ -52,7 +52,7 @@ export const use: {
<E, R, P extends {} = {}>(
self: ReactComponent<E, R, P>,
fn: (Component: React.FC<P>) => React.ReactNode,
): Effect.Effect<React.ReactNode, never, R>
): Effect.Effect<React.ReactNode, never, Exclude<R, Scope.Scope>>
} = Effect.fnUntraced(function*(self, fn) {
return fn(yield* useFC(self))
})

View File

@@ -68,7 +68,7 @@ const MyTestComponent = pipe(
const service = yield* SubService
const [value] = yield* ReactHook.useSubscribeRefs(service.ref)
yield* ReactHook.useEffect(() => Effect.andThen(
yield* ReactHook.useMemo(() => Effect.andThen(
Effect.addFinalizer(() => Console.log("MyTestComponent umounted")),
Console.log("MyTestComponent mounted"),
), [])