Refactor Result
Lint / lint (push) Failing after 35s

This commit is contained in:
Julien Valverdé
2025-11-17 04:09:26 +01:00
parent 9feb94ea9e
commit 70dcdf8160
3 changed files with 33 additions and 90 deletions
+6 -8
View File
@@ -65,7 +65,7 @@ export namespace make {
readonly onSubmit: (
this: Form<NoInfer<A>, NoInfer<I>, NoInfer<R>, unknown, unknown, unknown>,
value: NoInfer<A>,
) => Effect.Effect<SA, SE, Result.forkEffectPubSub.InputContext<SR, NoInfer<SP>>>
) => Effect.Effect<SA, SE, Result.forkEffect.InputContext<SR, NoInfer<SP>>>
readonly initialSubmitProgress?: SP
readonly autosubmit?: boolean
readonly debounce?: Duration.DurationInput
@@ -160,17 +160,15 @@ export const submit = <A, I, R, SA, SE, SR, SP>(
> => Effect.whenEffect(
self.valueRef.pipe(
Effect.andThen(identity),
Effect.andThen(value => Result.forkEffectPubSub(
self.onSubmit(value) as Effect.Effect<SA, SE, Result.forkEffectPubSub.InputContext<SR, SP>>,
Effect.andThen(value => Result.forkEffect(
self.onSubmit(value) as Effect.Effect<SA, SE, Result.forkEffect.InputContext<SR, SP>>,
{ initialProgress: self.initialSubmitProgress },
)),
Effect.andThen(identity),
Effect.andThen(Stream.fromQueue),
Stream.unwrapScoped,
Stream.runFoldEffect(
Effect.andThen(([result]) => Stream.runFoldEffect(
result.changes,
Result.initial() as Result.Result<SA, SE, SP>,
(_, result) => Effect.as(Ref.set(self.submitResultRef, result), result),
),
)),
Effect.tap(result => Result.isFailure(result)
? Option.match(
Chunk.findFirst(