TanStackT
TanStack8mo ago
7 replies
full-green

Can't redirect in server functions with middleware

I am not sure if this is a known issue/limitation, but from what I can tell, throwing redirects in server functions that use middleware don't work. It works fine if I remove the middleware since I am using the useServerFn() helper hook on the client.

The problem seems to be that the isRedirect() helper from @tanstack/router-core expects the response to be a type of Response with an options prop.

When using middleware, the response is a plain object.
Was this page helpful?