Skip to content

fix(router): action redirects#8780

Merged
wmertens merged 1 commit into
build/v2from
action-redirect
Jun 28, 2026
Merged

fix(router): action redirects#8780
wmertens merged 1 commit into
build/v2from
action-redirect

Conversation

@wmertens

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 27, 2026 17:16
@wmertens wmertens requested a review from a team as a code owner June 27, 2026 17:16
@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 418fed6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@qwik.dev/router Patch
eslint-plugin-qwik Patch
@qwik.dev/core Patch
create-qwik Patch
@qwik.dev/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@8780

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@8780

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@8780

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@8780

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@8780

commit: 418fed6

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Qwik Router “action redirect” behavior for JSON action submissions by returning a JSON redirect envelope (instead of an HTTP 3xx that fetch would auto-follow) and teaching the client router to navigate when that envelope is received.

Changes:

  • Convert action redirects caught by jsonRequestWrapper() into a JSON action response containing { redirect: <url> }.
  • Update client-side action handling to call goto() when the action response includes redirect.
  • Add e2e coverage and a test route to validate both the JSON envelope shape and SPA navigation on redirect.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/qwik-router/src/runtime/src/qwik-router-component.tsx Trigger client navigation when an action result includes a redirect field.
packages/qwik-router/src/middleware/request-handler/handlers/json-request-wrapper.ts Serialize action redirects as JSON (avoids fetch auto-following 3xx).
e2e/qwik-e2e/tests/qwikrouter/returned-control-flow.e2e.ts Adds regression tests for JSON action redirect envelope + SPA navigation.
e2e/qwik-e2e/apps/qwikrouter-test/src/routes/returned-control-flow/action-redirect/index.tsx Adds a routeAction-based redirect fixture for the new e2e tests.
.changeset/goofy-doodles-decide.md Adds a changeset for the router behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/qwik-router/src/runtime/src/qwik-router-component.tsx
Comment thread .changeset/goofy-doodles-decide.md Outdated
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 418fed6

@wmertens wmertens merged commit ecbb561 into build/v2 Jun 28, 2026
48 checks passed
@wmertens wmertens deleted the action-redirect branch June 28, 2026 10:05
@github-project-automation github-project-automation Bot moved this from Waiting For Review to Done in Qwik Development Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants