diff --git a/packages/effect-fc/src/Hook.ts b/packages/effect-fc/src/Hook.ts index de45e88..b9fc28d 100644 --- a/packages/effect-fc/src/Hook.ts +++ b/packages/effect-fc/src/Hook.ts @@ -167,10 +167,13 @@ export const useFork: { React.useEffect(() => { const scope = Runtime.runSync(runtime)(options?.scope ? 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 }) - return () => closeScope(scope, runtime, options) + return () => closeScope(scope, runtime, { + ...options, + finalizerExecutionMode: options?.finalizerExecutionMode ?? "fork", + }) }, deps) }) diff --git a/packages/example/src/routes/index.tsx b/packages/example/src/routes/index.tsx index 2baf5e4..447cd62 100644 --- a/packages/example/src/routes/index.tsx +++ b/packages/example/src/routes/index.tsx @@ -13,6 +13,6 @@ export const Route = createFileRoute("/")({ const context = yield* Hook.useContextSync(TodosStateLive, { finalizerExecutionMode: "fork" }) return yield* Effect.provide(Component.use(Todos, Todos => ), context) }).pipe( - Component.withRuntime(runtime.context), + Component.withRuntime(runtime.context) ) })