Skip to content

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

@pavandv

Description

@pavandv

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions