From 35750c45403d50d90a2b98614e233fda9e1fda5e Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Sat, 4 Jul 2026 18:01:48 +0200 Subject: [PATCH] Fix Vue interrupt repro tests --- .changeset/fix-vue-interrupt-tests.md | 5 +++++ packages/vue/test/interrupt-refetch-repro.test.ts | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/fix-vue-interrupt-tests.md diff --git a/.changeset/fix-vue-interrupt-tests.md b/.changeset/fix-vue-interrupt-tests.md new file mode 100644 index 000000000..e08911de1 --- /dev/null +++ b/.changeset/fix-vue-interrupt-tests.md @@ -0,0 +1,5 @@ +--- +"@effect-app/vue": patch +--- + +Fix interrupt repro tests to observe expected suspense interruption rejections. diff --git a/packages/vue/test/interrupt-refetch-repro.test.ts b/packages/vue/test/interrupt-refetch-repro.test.ts index 8181108e0..2b110300d 100644 --- a/packages/vue/test/interrupt-refetch-repro.test.ts +++ b/packages/vue/test/interrupt-refetch-repro.test.ts @@ -122,6 +122,10 @@ const settle = (p: Promise | undefined) => new Promise<"pending">((resolve) => setTimeout(() => resolve("pending"), 40)) ]) +const ignoreSuspenseInterrupt = (p: Promise | undefined) => { + p?.catch(() => {}) +} + const writeCommand = (repo: DataDependencies.DataDependency) => DataDependencies.write(repo).pipe(Effect.as(undefined)) const drain = (fiber: Fiber.Fiber) => Effect.runPromise(Fiber.interrupt(fiber) as any).then(() => {}, () => {}) @@ -141,6 +145,7 @@ it.fails("A1 — unload during the INITIAL fetch: remount must refetch, not hang await ticks(2) expect(g.starts()).toBe(1) + ignoreSuspenseInterrupt(m1.getPromise()) m1.app.unmount() // page unload -> interrupt the in-flight initial fetch await ticks(2) @@ -351,6 +356,7 @@ it("M2 — one of two concurrent callers unmounts mid-fetch: the other still res await ticks(2) expect(g.starts()).toBe(1) + ignoreSuspenseInterrupt(a.getPromise()) a.app.unmount() // caller A loses interest -> interrupts ITS await only await ticks(2) g.releaseAll() // the shared fetch must survive for caller B @@ -568,6 +574,7 @@ it.fails("D1 — sole listener interrupts an in-flight request; a NEW listener s await ticks(2) expect(g.starts()).toBe(1) + ignoreSuspenseInterrupt(l1.getPromise()) l1.app.unmount() // the only interested caller leaves -> the in-flight request should be abandoned await ticks(2) g.setBlocking(false)