From d8961aa771a3d2048d290ee3bb4bc8919a40efa8 Mon Sep 17 00:00:00 2001 From: mantrakp04 Date: Thu, 30 Apr 2026 16:07:24 -0700 Subject: [PATCH] Fix TanStack Start SSR redirects --- .../apps/implementations/client-app-impl.ts | 32 +++++++++++++++++-- packages/template/src/lib/stack-app/common.ts | 1 + 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts b/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts index 123c33750..e9dcd5be4 100644 --- a/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts +++ b/packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts @@ -38,6 +38,7 @@ import type { TurnstileAction } from "@stackframe/stack-shared/dist/utils/turnst import { isRelative } from "@stackframe/stack-shared/dist/utils/urls"; import { generateUuid } from "@stackframe/stack-shared/dist/utils/uuids"; import * as tanstackStartServerContext from "@stackframe/tanstack-start/tanstack-start-server-context"; // THIS_LINE_PLATFORM tanstack-start +import * as TanStackRouter from "@tanstack/react-router"; // THIS_LINE_PLATFORM tanstack-start import * as cookie from "cookie"; import * as NextNavigationUnscrambled from "next/navigation"; // import the entire module to get around some static compiler warnings emitted by Next.js in some cases | THIS_LINE_PLATFORM next import React, { useCallback, useMemo } from "react"; // THIS_LINE_PLATFORM react-like @@ -568,6 +569,7 @@ export class _StackClientAppImplIncomplete router.push(to); // END_PLATFORM + // IF_PLATFORM tanstack-start + } else if (this._redirectMethod === "tanstack-start") { + return (to: string) => window.location.assign(to); + // END_PLATFORM } else { return (to: string) => { }; } @@ -2532,6 +2542,20 @@ export class _StackClientAppImplIncomplete (to: string) => void,