diff --git a/packages/effect-fc/src/Form.ts b/packages/effect-fc/src/Form.ts
index b91ff37..360598f 100644
--- a/packages/effect-fc/src/Form.ts
+++ b/packages/effect-fc/src/Form.ts
@@ -105,7 +105,7 @@ export const make: {
export const run = (
self: Form
-): Effect.Effect => Stream.runForEach(
+): Effect.Effect => Stream.runForEach(
self.encodedValueRef.changes.pipe(
Option.isSome(self.debounce) ? Stream.debounce(self.debounce.value) : identity
),
@@ -125,21 +125,22 @@ export const run = (
Effect.andThen(SubscriptionRef.set(self.errorRef, Option.none())),
Effect.as(Option.some(v)),
),
- onFailure: c => Option.match(
- Chunk.findFirst(Cause.failures(c), e => e._tag === "ParseError"),
- {
- onSome: e => Effect.as(SubscriptionRef.set(self.errorRef, Option.some(e)), Option.none()),
- onNone: () => Effect.succeed(Option.none()),
- },
+ onFailure: c => Chunk.findFirst(Cause.failures(c), e => e._tag === "ParseError").pipe(
+ Option.match({
+ onSome: e => SubscriptionRef.set(self.errorRef, Option.some(e)),
+ onNone: () => Effect.void,
+ }),
+ Effect.as(Option.none()),
),
}),
Effect.uninterruptible,
)),
+ Effect.scoped,
+
Effect.andThen(value => Option.isSome(value) && self.autosubmit
- ?
+ ? Effect.asVoid(Effect.forkScoped(submit(self)))
: Effect.void
),
- Effect.scoped,
Effect.forkScoped,
)
),
@@ -175,7 +176,7 @@ export namespace service {
export const service = (
options: service.Options
-): Effect.Effect