Skip to content

redirect inside createServerFn handler isn't working #6010

@nandcello

Description

@nandcello

Which project does this relate to?

Router

Describe the bug

So I have a button that when clicked, triggers a server function with a redirect inside. When I click the button, it doesn't redirect at all. I've tried throwing the redirect as well as setting throw: true but still isn't working. I've also tried with an external link via href option and also an internal link via to option but both aren't working as well. even tried reloadDocument: true and also replace: true.

Your Example Website or App

https://github.com/nandcello/repro-redirect-bug

Steps to Reproduce the Bug or Issue

  1. bun create @tanstack/start@latest
  2. add a button that calls a createServerFn with handler
  throw redirect({
    to: '/demo/start/ssr',
    // throw: true // this also doesn't work 
  })
  1. click the button to trigger the server fn
  2. nothing happens

Expected behavior

As a user, I expect to be redirected to the link.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.0
  • OS: macOS
  • Browser: Safari & Edge
  • Browser Version: 142.0.3595.94 (Official build) (arm64)
  • Bundler: vite
  • Bundler Version: 7.1.7

Additional context

As per server fn docs, i should be able to do this

Metadata

Metadata

Assignees

No one assigned

    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