Fix
All checks were successful
Lint / lint (push) Successful in 12s

This commit is contained in:
Julien Valverdé
2025-10-27 18:36:41 +01:00
parent 86e8a7bd92
commit 8c8560b63c
3 changed files with 23 additions and 10 deletions

View File

@@ -97,7 +97,7 @@ export const make: {
Option.isSome(value) &&
Option.isNone(error) &&
Option.isNone(validationFiber) &&
(Result.isRunning(submitResult) || Result.isRefreshing(submitResult))
!(Result.isRunning(submitResult) || Result.isRefreshing(submitResult))
),
),
)
@@ -194,7 +194,7 @@ export const field = <A, I, R, SA, SE, SR, const P extends PropertyPath.Paths<No
onNone: () => Effect.succeed([]),
})),
Subscribable.map(self.validationFiberRef, Option.isSome),
Subscribable.map(self.submitResultRef, flow(Result.isRunning, Result.isRefreshing)),
Subscribable.map(self.submitResultRef, result => Result.isRunning(result) || Result.isRefreshing(result)),
)

View File

@@ -102,13 +102,14 @@ export const isSuccess = (u: unknown): u is Success<unknown> => isResult(u) && u
export const isFailure = (u: unknown): u is Failure<unknown, unknown> => isResult(u) && u._tag === "Failure"
export const isRefreshing = (u: unknown): u is Refreshing<unknown> => isResult(u) && Predicate.hasProperty(u, "refreshing") && u.refreshing
export const initial = (): Initial => Object.setPrototypeOf({}, ResultPrototype)
export const running = <P = never>(progress?: P): Running<P> => Object.setPrototypeOf({ progress }, ResultPrototype)
export const succeed = <A>(value: A): Success<A> => Object.setPrototypeOf({ value }, ResultPrototype)
export const initial = (): Initial => Object.setPrototypeOf({ _tag: "Initial" }, ResultPrototype)
export const running = <P = never>(progress?: P): Running<P> => Object.setPrototypeOf({ _tag: "Running", progress }, ResultPrototype)
export const succeed = <A>(value: A): Success<A> => Object.setPrototypeOf({ _tag: "Success", value }, ResultPrototype)
export const fail = <E, A = never>(
cause: Cause.Cause<E>,
previousSuccess?: Success<A>,
): Failure<A, E> => Object.setPrototypeOf({
_tag: "Failure",
cause,
previousSuccess: Option.fromNullable(previousSuccess),
}, ResultPrototype)
@@ -144,10 +145,11 @@ export const forkEffectScoped = <A, E, R>(
effect: Effect.Effect<A, E, R>
): Effect.Effect<Queue.Dequeue<Result<A, E>>, never, Scope.Scope | R> => Queue.unbounded<Result<A, E>>().pipe(
Effect.tap(Queue.offer(initial())),
Effect.tap(queue => Effect.forkScoped(Queue.offer(queue, running()).pipe(
Effect.tap(queue => Effect.forkScoped(Effect.addFinalizer(() => Queue.shutdown(queue)).pipe(
Effect.andThen(Queue.offer(queue, running())),
Effect.andThen(effect),
Effect.exit,
Effect.andThen(exit => Queue.offer(queue, fromExit(exit))),
Effect.andThen(Queue.shutdown(queue)),
Effect.scoped,
))),
)