0.1.0 #1
@@ -167,10 +167,13 @@ export const useFork: {
|
|||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const scope = Runtime.runSync(runtime)(options?.scope
|
const scope = Runtime.runSync(runtime)(options?.scope
|
||||||
? Scope.fork(options.scope, options?.finalizerExecutionStrategy ?? ExecutionStrategy.sequential)
|
? Scope.fork(options.scope, options?.finalizerExecutionStrategy ?? ExecutionStrategy.sequential)
|
||||||
: Scope.make(options?.finalizerExecutionStrategy)
|
: Scope.make(options?.finalizerExecutionStrategy ?? ExecutionStrategy.sequential)
|
||||||
)
|
)
|
||||||
Runtime.runFork(runtime)(Effect.provideService(effect(), Scope.Scope, scope), { ...options, scope })
|
Runtime.runFork(runtime)(Effect.provideService(effect(), Scope.Scope, scope), { ...options, scope })
|
||||||
return () => closeScope(scope, runtime, options)
|
return () => closeScope(scope, runtime, {
|
||||||
|
...options,
|
||||||
|
finalizerExecutionMode: options?.finalizerExecutionMode ?? "fork",
|
||||||
|
})
|
||||||
}, deps)
|
}, deps)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ export const Route = createFileRoute("/")({
|
|||||||
const context = yield* Hook.useContextSync(TodosStateLive, { finalizerExecutionMode: "fork" })
|
const context = yield* Hook.useContextSync(TodosStateLive, { finalizerExecutionMode: "fork" })
|
||||||
return yield* Effect.provide(Component.use(Todos, Todos => <Todos />), context)
|
return yield* Effect.provide(Component.use(Todos, Todos => <Todos />), context)
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Component.withRuntime(runtime.context),
|
Component.withRuntime(runtime.context)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user