Cleanup
All checks were successful
Lint / lint (push) Successful in 10s

This commit is contained in:
Julien Valverdé
2025-01-22 03:21:31 +01:00
parent 22e5bbfcc2
commit 5a19b4a2ce

View File

@@ -299,29 +299,29 @@ export class Reffuse<R> {
// return React.use(promise)
// }
useSuspenseScoped<A, E>(
effect: Effect.Effect<A, E, R | Scope.Scope>,
deps?: React.DependencyList,
options?: { readonly signal?: AbortSignal } & RenderOptions & ScopeOptions,
): A {
const runSync = this.useRunSync()
const runPromise = this.useRunPromise()
// useSuspenseScoped<A, E>(
// effect: Effect.Effect<A, E, R | Scope.Scope>,
// deps?: React.DependencyList,
// options?: { readonly signal?: AbortSignal } & RenderOptions & ScopeOptions,
// ): A {
// const runSync = this.useRunSync()
// const runPromise = this.useRunPromise()
const initialPromise = React.useMemo(() => runPromise(Effect.scoped(effect)), [])
const [promise, setPromise] = React.useState(initialPromise)
// const initialPromise = React.useMemo(() => runPromise(Effect.scoped(effect)), [])
// const [promise, setPromise] = React.useState(initialPromise)
React.useEffect(() => {
const scope = runSync(Scope.make())
setPromise(runPromise(Effect.provideService(effect, Scope.Scope, scope), options))
// React.useEffect(() => {
// const scope = runSync(Scope.make())
// setPromise(runPromise(Effect.provideService(effect, Scope.Scope, scope), options))
return () => { runPromise(Scope.close(scope, Exit.void)) }
}, [
...options?.doNotReExecuteOnRuntimeOrContextChange ? [] : [runSync, runPromise],
...(deps ?? []),
])
// return () => { runPromise(Scope.close(scope, Exit.void)) }
// }, [
// ...options?.doNotReExecuteOnRuntimeOrContextChange ? [] : [runSync, runPromise],
// ...(deps ?? []),
// ])
return React.use(promise)
}
// return React.use(promise)
// }
useRef<A>(value: A): SubscriptionRef.SubscriptionRef<A> {