[PR #603] [CLOSED] fix: include query string in route handler ISR cache key #704

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/603
Author: @southpolesteve
Created: 3/20/2026
Status: Closed

Base: mainHead: fix/include-query-in-route-handler-isr-key


📝 Commits (2)

  • 4b02051 fix: include query string in route handler ISR cache key
  • 3e651ea fix: normalize query params in ISR cache key and update tests

📊 Changes

3 files changed (+92 additions, -15 deletions)

View changed files

📝 packages/vinext/src/entries/app-rsc-entry.ts (+13 -2)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+78 -12)
📝 tests/app-router.test.ts (+1 -1)

📄 Description

Summary

  • Route handler ISR cache keys now include the query string, so /api/data?user=alice and /api/data?user=bob produce distinct cache entries.
  • Applied to both the cache read (HIT) and cache write (MISS) paths.

Details

Previously, __isrRouteKey(cleanPathname) used only the pathname for the cache key. Route handlers that return different responses based on searchParams would cache the first response and serve it for all subsequent requests regardless of query parameters.

The fix extracts the query string from request.url and appends it to the pathname before computing the cache key. Only GET/HEAD requests are affected (POST/PUT/etc. are never ISR-cached).


🔄 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/603 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 3/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/include-query-in-route-handler-isr-key` --- ### 📝 Commits (2) - [`4b02051`](https://github.com/cloudflare/vinext/commit/4b02051116173e02e12af035e462316a8938527c) fix: include query string in route handler ISR cache key - [`3e651ea`](https://github.com/cloudflare/vinext/commit/3e651eacda82ef12ea9d82cb4985ef3312b03d2b) fix: normalize query params in ISR cache key and update tests ### 📊 Changes **3 files changed** (+92 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/app-rsc-entry.ts` (+13 -2) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+78 -12) 📝 `tests/app-router.test.ts` (+1 -1) </details> ### 📄 Description ## Summary - Route handler ISR cache keys now include the query string, so `/api/data?user=alice` and `/api/data?user=bob` produce distinct cache entries. - Applied to both the cache read (HIT) and cache write (MISS) paths. ## Details Previously, `__isrRouteKey(cleanPathname)` used only the pathname for the cache key. Route handlers that return different responses based on `searchParams` would cache the first response and serve it for all subsequent requests regardless of query parameters. The fix extracts the query string from `request.url` and appends it to the pathname before computing the cache key. Only GET/HEAD requests are affected (POST/PUT/etc. are never ISR-cached). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:40 +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#704
No description provided.