diff --git a/packages/reffuse/src/ReffuseContext.ts b/packages/reffuse/src/ReffuseContext.ts index 1454acd..95466a4 100644 --- a/packages/reffuse/src/ReffuseContext.ts +++ b/packages/reffuse/src/ReffuseContext.ts @@ -76,10 +76,8 @@ const makeProvider = (Context: React.Context>): ReactProvi export type AsyncReactProvider = React.FC<{ readonly layer: Layer.Layer - readonly options?: { - readonly scope?: Scope.Scope - readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy - } + readonly scope?: Scope.Scope + readonly finalizerExecutionStrategy?: ExecutionStrategy.ExecutionStrategy readonly fallback?: React.ReactNode readonly children?: React.ReactNode }> @@ -106,9 +104,9 @@ const makeAsyncProvider = (Context: React.Context>): Async const { promise, resolve, reject } = Promise.withResolvers>() setPromise(promise) - const scope = runSync(props.options?.scope - ? Scope.fork(props.options.scope, props.options?.finalizerExecutionStrategy ?? ExecutionStrategy.sequential) - : Scope.make(props.options?.finalizerExecutionStrategy) + const scope = runSync(props.scope + ? Scope.fork(props.scope, props.finalizerExecutionStrategy ?? ExecutionStrategy.sequential) + : Scope.make(props.finalizerExecutionStrategy) ) Effect.context().pipe( @@ -119,7 +117,7 @@ const makeAsyncProvider = (Context: React.Context>): Async Effect.provide(props.layer), Effect.provideService(Scope.Scope, scope), - effect => runFork(effect, { ...props.options, scope }), + effect => runFork(effect, { ...props, scope }), ) return () => { runFork(Scope.close(scope, Exit.void)) }