From df5c5884ae7f50716d229442cb34cde32bb4861e Mon Sep 17 00:00:00 2001 From: BilalG1 Date: Tue, 31 Mar 2026 16:00:22 -0700 Subject: [PATCH] Fix default redirectMethod for Node.js environments (#1301) ## Summary - Fixes the default `redirectMethod` to check `typeof window !== "undefined"` before defaulting to `"window"` - In Node.js/CLI environments (where `window` is undefined), defaults to `"none"` instead, preventing runtime errors ## Context PR #1253 changed the default `redirectMethod` from `"none"` to `"window"`, but this breaks non-browser environments (Node.js scripts, CLI tools, backend services) that don't have a `window` object. ## Test plan - [ ] Verify existing e2e tests pass (they explicitly set `redirectMethod: "none"`) - [ ] Verify browser usage still defaults to `"window"` - [ ] Verify Node.js usage (e.g. `stack-cli`) defaults to `"none"` ## Summary by CodeRabbit * **Bug Fixes** * Fixed redirect behavior so client-side redirects continue in browser environments, while non-browser or server-side executions now default to no automatic redirect, avoiding unexpected navigation. Existing platform-specific redirect handling remains unchanged. --- .../src/lib/stack-app/apps/implementations/client-app-impl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 bcaee7fca..01c29686b 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 @@ -530,7 +530,7 @@ export class _StackClientAppImplIncomplete