Repository navigation
fix(pages): keep the named action key first when a redirect repeats the request - #533
Conversation
…he request
A redirect that keeps the action key (307/308, or 301/302 after PUT,
PATCH or DELETE) merged it after the destination's own query, so
PUT /books?delete&page=2 + c.redirect('/books-v2?tab=details', 302) went
to /books-v2?tab=details&delete=&page=2 and the repeated PUT picked
"tab" as the action.
- Destination with its own query: the key goes first again, as sent;
if the destination sets the same key, its value wins and moves first.
- Same page with its own first key (c.redirect('/books?archive', 307)):
that key picks the action, and the request's key is dropped.
- A bare "?" still drops the rest of the query but keeps the key.
- No destination query, GET follow-ups and redirect rules are unchanged.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1910f371d8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Only the destination's own value for the action key replaces the key. Before, a repeated key in the request query (?moveTab&moveTab=secondary) was promoted and the first one was dropped. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-action-key-first-void-cloud.voidzero-docs.workers.dev (commit 69c68c3)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
The suspension and route-disable race tests attach a handler to the racing promise only after awaiting the lock waiter and the competing transaction. If the promise rejects first, Vitest reports an unhandled rejection and fails the file even though every test passed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Follow-up to #530 (Codex finding on that PR, which got merged before this fix landed).
Problem
A redirect that sends the same request again keeps the action key (307/308, or 301/302 after PUT/PATCH/DELETE). When the destination has its own query, the merge put the key after the destination's params:
Fix (only in the
c.redirectwrapper)/books-v2?tab=details(another page)/books-v2?delete&tab=details&page=2(key first, as sent)/books-v2?tab=1&delete=x(sets the key too)/books-v2?delete=x&tab=1&page=2(its value wins, moves first)/books?archive(same page, own first key)/books?archive=&page=2(that key picks the action)/books-v2?(bare reset)/books-v2?delete(rest dropped, key kept)/books-v2(no query)/books-v2?delete&page=2(unchanged, byte for byte)#fragmentUnchanged: GET follow-ups (key dropped), unmarked requests,
mergeQueryIntoLocation, redirect rules and platform dispatch.Known limit: a redirect to a different page whose first query key is one of that page's actions (
c.redirect('/other?archive', 307)) still puts the request's key first. The redirect code can't tell an action key from a normal param on another page.Tests
routing-runtime.test.ts: 10 new rows in the named-action table (307 and PUT 302 with a destination query, a valued key, a fragment, a bare?, the same key in the destination, a same-page action key). 9 fail on main. The POST 302 row passes on main too: it checks the GET follow-up stays unchanged. routing-runtime, pages-client, pages-compile and compile tests: 205/205. Lint, format and typecheck are clean.🤖 Generated with Claude Code