web-infra-dev / web-infra-dev/modern.js

[Bug]: [V3] redirecting doesn't work within actions

Open
#8,563 2 comments 0 reactions 1 assignee View on GitHub

@zllkjc is already working on this.

Since May 11, 2026.

Dominant language
TypeScript
Stars
5k
Forks
421
Avg merge
6d 2h
Merged PRs (30d)
50

Description

Version
System:
    OS: macOS 26.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1000.30 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Safari: 26.4
  npmPackages:
    @modern-js/app-tools: ^3.1.2 => 3.1.3 
    @modern-js/plugin-bff: ^3.1.2 => 3.1.3 
    @modern-js/runtime: ^3.1.2 => 3.1.3 
    @modern-js/server-runtime: ^3.1.2 => 3.1.3 
    @modern-js/tsconfig: ^3.1.2 => 3.1.3
Details

Redirecting to any page in an action doesn't work at all.

// some-route/page.data.ts

import { redirect } from '@modern-js/runtime/router';

export async function action() {
  throw redirect('/dashboard');
  // or return redirect('/dashboard')
}
Reproduce link

can be reproducible with a simple starter app

Reproduce Steps

can be reproducible with a simple starter app.

  1. create two pages in routes folder (page-a.tsx, page-b.tsx, page-b.data.ts)
  2. write an action method in page-b.data.ts with redirect to page-a
  3. Run the app
  4. redirect to page-b

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.