[PR #975] [MERGED] fix: add SWR non-blocking guard tests for route handler ISR #995

Closed
opened 2026-05-06 13:11:27 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/975
Author: @Divkix
Created: 4/30/2026
Status: Merged
Merged: 4/30/2026
Merged by: @james-elicx

Base: mainHead: fix/959-route-handler-swr-block


📝 Commits (2)

  • 4393da6 fix: add SWR non-blocking guard tests for route handler ISR (#959)
  • 309688a docs: clarify porting attribution in SWR ISR tests

📊 Changes

2 files changed (+71 additions, -1 deletions)

View changed files

📝 tests/app-router.test.ts (+51 -1)
tests/fixtures/app-basic/app/api/slow-isr/route.ts (+20 -0)

📄 Description

Fixes #959

Summary

  • Audited the App Router route handler runtime for the pendingWaitUntil / pipe-readable blocking pattern from the Next.js fix (vercel/next.js#93189)
  • Confirmed no bug: vinext correctly uses ctx.waitUntil() for all background cache writes and regenerations — no equivalent of the Next.js pendingWaitUntil / pipe-readable blocking exists
  • Added explicit timing assertions to the existing route handler STALE test to guard against regressions
  • Added a new slow-ISR route handler fixture and test that verifies stale responses complete quickly (< 500ms) even when the handler has a 1s delay, ported from Next.js test/e2e/app-dir/use-cache-swr/use-cache-swr.test.ts

Test plan

  • it("route handler ISR: STALE serves stale data and triggers background regen") — added staleDuration < 500ms assertion
  • it("route handler ISR: STALE completes quickly without blocking on background regen") — new test with slow handler fixture, verifies cold request ≥ 700ms, stale response < 500ms, background regen completes successfully

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/975 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 4/30/2026 **Status:** ✅ Merged **Merged:** 4/30/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/959-route-handler-swr-block` --- ### 📝 Commits (2) - [`4393da6`](https://github.com/cloudflare/vinext/commit/4393da64215ac656672aef6ff2c63b10a7af0e87) fix: add SWR non-blocking guard tests for route handler ISR (#959) - [`309688a`](https://github.com/cloudflare/vinext/commit/309688a4e78cbf2823c1c18c1267f202a2ca26e7) docs: clarify porting attribution in SWR ISR tests ### 📊 Changes **2 files changed** (+71 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `tests/app-router.test.ts` (+51 -1) ➕ `tests/fixtures/app-basic/app/api/slow-isr/route.ts` (+20 -0) </details> ### 📄 Description Fixes #959 ## Summary - **Audited** the App Router route handler runtime for the `pendingWaitUntil` / `pipe-readable` blocking pattern from the Next.js fix ([vercel/next.js#93189](https://github.com/vercel/next.js/pull/93189)) - **Confirmed no bug**: vinext correctly uses `ctx.waitUntil()` for all background cache writes and regenerations — no equivalent of the Next.js `pendingWaitUntil` / `pipe-readable` blocking exists - Added explicit timing assertions to the existing route handler STALE test to guard against regressions - Added a new slow-ISR route handler fixture and test that verifies stale responses complete quickly (< 500ms) even when the handler has a 1s delay, ported from Next.js `test/e2e/app-dir/use-cache-swr/use-cache-swr.test.ts` ## Test plan - `it("route handler ISR: STALE serves stale data and triggers background regen")` — added `staleDuration < 500ms` assertion - `it("route handler ISR: STALE completes quickly without blocking on background regen")` — new test with slow handler fixture, verifies cold request ≥ 700ms, stale response < 500ms, background regen completes successfully --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#995
No description provided.