From 1fa2440d711dda428adf964921592c4e4ff4934f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 20 Jul 2026 07:20:26 +0200 Subject: [PATCH] Fix --- packages/effect-fc-next/src/Query.ts | 36 +++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/effect-fc-next/src/Query.ts b/packages/effect-fc-next/src/Query.ts index c1eb7eb..73aac39 100644 --- a/packages/effect-fc-next/src/Query.ts +++ b/packages/effect-fc-next/src/Query.ts @@ -1,4 +1,4 @@ -import { type Cause, type Context, Duration, Effect, Equal, type Equivalence, Exit, Fiber, Option, Pipeable, Predicate, PubSub, Ref, type Scope, Semaphore, Stream, SubscriptionRef } from "effect" +import { Cause, type Context, Duration, Effect, Equal, type Equivalence, Exit, Fiber, Option, Pipeable, Predicate, PubSub, Ref, type Scope, Semaphore, Stream, SubscriptionRef } from "effect" import { AsyncResult } from "effect/unstable/reactivity" import * as Lens from "./Lens.js" import * as QueryClient from "./QueryClient.js" @@ -271,24 +271,26 @@ extends Pipeable.Class implements Query { key: previous.key, result: AsyncResult.success(v), }), - onFailure: c => AsyncResult.match(previous.result, { - onInitial: () => ({ - key: previous.key, - result: AsyncResult.failure(c), - }), - onSuccess: v => ({ - key: previous.key, - result: AsyncResult.failure(c, { - previousSuccess: Option.some(v), + onFailure: c => Cause.hasInterruptsOnly(c) + ? previous + : AsyncResult.match(previous.result, { + onInitial: () => ({ + key: previous.key, + result: AsyncResult.failure(c), + }), + onSuccess: v => ({ + key: previous.key, + result: AsyncResult.failure(c, { + previousSuccess: Option.some(v), + }), + }), + onFailure: v => ({ + key: previous.key, + result: AsyncResult.failure(c, { + previousSuccess: v.previousSuccess, + }), }), }), - onFailure: v => ({ - key: previous.key, - result: AsyncResult.failure(c, { - previousSuccess: v.previousSuccess, - }), - }), - }), }), )) as FinalQueryState