From 331c2ed2eda3a7cefb90a1b1c2ea99c030c7041a Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 24 Aug 2026 12:32:45 -0700 Subject: [PATCH] refactor(auth): drop the isProduction prop nothing on the signin path reads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same shape as the `isWorkflowRunning` removal: declared, required, threaded through every layer, and never read at the end of the chain. `SocialLoginButtons` declares `isProduction: boolean` as a REQUIRED prop and never reads it, so every caller had to produce and forward a value that was discarded. Neither `login-form` nor `signup-form` reads it either — each only declares it, destructures it, and passes it down. `signup-form` forwards it twice, through its own inner `SignupFormContent` hop. With the chain gone, `getOAuthProviderStatus` has no consumer for the `isProduction: isProd` it returned: the pages destructured it only to forward it, and `/api/auth/providers` already takes just the three availability flags. So the return value and its `isProd` import go too. `isProduction` stays alive where it is genuinely used — `verify-content.tsx` branches on it and hands it to `useVerification`, and imports `isProd` directly rather than through this helper. That path is untouched. Found by the rule enabled in #7037: it was the only `.tsx` unused-parameter warning in `apps/sim`. --- apps/sim/app/(auth)/components/oauth-provider-checker.tsx | 3 +-- apps/sim/app/(auth)/components/social-login-buttons.tsx | 2 -- apps/sim/app/(auth)/login/login-form.tsx | 3 --- apps/sim/app/(auth)/login/page.tsx | 4 +--- apps/sim/app/(auth)/signup/page.tsx | 4 +--- apps/sim/app/(auth)/signup/signup-form.tsx | 5 ----- 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/apps/sim/app/(auth)/components/oauth-provider-checker.tsx b/apps/sim/app/(auth)/components/oauth-provider-checker.tsx index ee2f4ede8a..a8ba38dcfb 100644 --- a/apps/sim/app/(auth)/components/oauth-provider-checker.tsx +++ b/apps/sim/app/(auth)/components/oauth-provider-checker.tsx @@ -3,7 +3,6 @@ import { isGithubAuthDisabled, isGoogleAuthDisabled, isMicrosoftAuthDisabled, - isProd, } from '@/lib/core/config/env-flags' export async function getOAuthProviderStatus() { @@ -16,5 +15,5 @@ export async function getOAuthProviderStatus() { const microsoftAvailable = !!(env.MICROSOFT_CLIENT_ID && env.MICROSOFT_CLIENT_SECRET) && !isMicrosoftAuthDisabled - return { githubAvailable, googleAvailable, microsoftAvailable, isProduction: isProd } + return { githubAvailable, googleAvailable, microsoftAvailable } } diff --git a/apps/sim/app/(auth)/components/social-login-buttons.tsx b/apps/sim/app/(auth)/components/social-login-buttons.tsx index c2156e7dd3..c200d86bd1 100644 --- a/apps/sim/app/(auth)/components/social-login-buttons.tsx +++ b/apps/sim/app/(auth)/components/social-login-buttons.tsx @@ -15,7 +15,6 @@ interface SocialLoginButtonsProps { googleAvailable: boolean microsoftAvailable: boolean callbackURL?: string - isProduction: boolean children?: ReactNode } @@ -24,7 +23,6 @@ export function SocialLoginButtons({ googleAvailable, microsoftAvailable, callbackURL = '/workspace', - isProduction, children, }: SocialLoginButtonsProps) { const [isGithubLoading, setIsGithubLoading] = useState(false) diff --git a/apps/sim/app/(auth)/login/login-form.tsx b/apps/sim/app/(auth)/login/login-form.tsx index d3c7d8bd6e..cfe0b1403b 100644 --- a/apps/sim/app/(auth)/login/login-form.tsx +++ b/apps/sim/app/(auth)/login/login-form.tsx @@ -87,13 +87,11 @@ export default function LoginPage({ githubAvailable, googleAvailable, microsoftAvailable, - isProduction, registrationDisabled, }: { githubAvailable: boolean googleAvailable: boolean microsoftAvailable: boolean - isProduction: boolean /** DISABLE_REGISTRATION. Hides the signup cross-link, which `/signup` blocks. */ registrationDisabled: boolean }) { @@ -430,7 +428,6 @@ export default function LoginPage({ googleAvailable={googleAvailable} githubAvailable={githubAvailable} microsoftAvailable={microsoftAvailable} - isProduction={isProduction} callbackURL={callbackUrl} > {ssoEnabled && !hasOnlySSO && ( diff --git a/apps/sim/app/(auth)/login/page.tsx b/apps/sim/app/(auth)/login/page.tsx index 3b0c3f6a96..726727b143 100644 --- a/apps/sim/app/(auth)/login/page.tsx +++ b/apps/sim/app/(auth)/login/page.tsx @@ -12,8 +12,7 @@ export const metadata: Metadata = { export const dynamic = 'force-dynamic' export default async function LoginPage() { - const { githubAvailable, googleAvailable, microsoftAvailable, isProduction } = - await getOAuthProviderStatus() + const { githubAvailable, googleAvailable, microsoftAvailable } = await getOAuthProviderStatus() return ( }> @@ -21,7 +20,6 @@ export default async function LoginPage() { githubAvailable={githubAvailable} googleAvailable={googleAvailable} microsoftAvailable={microsoftAvailable} - isProduction={isProduction} registrationDisabled={isRegistrationDisabled} /> diff --git a/apps/sim/app/(auth)/signup/page.tsx b/apps/sim/app/(auth)/signup/page.tsx index d43dc7c047..496f779b7f 100644 --- a/apps/sim/app/(auth)/signup/page.tsx +++ b/apps/sim/app/(auth)/signup/page.tsx @@ -36,15 +36,13 @@ export default async function SignupPage({ ) } - const { githubAvailable, googleAvailable, microsoftAvailable, isProduction } = - await getOAuthProviderStatus() + const { githubAvailable, googleAvailable, microsoftAvailable } = await getOAuthProviderStatus() return ( diff --git a/apps/sim/app/(auth)/signup/signup-form.tsx b/apps/sim/app/(auth)/signup/signup-form.tsx index ad0d5213b9..94c4b74dfe 100644 --- a/apps/sim/app/(auth)/signup/signup-form.tsx +++ b/apps/sim/app/(auth)/signup/signup-form.tsx @@ -91,7 +91,6 @@ interface SignupFormProps { githubAvailable: boolean googleAvailable: boolean microsoftAvailable: boolean - isProduction: boolean emailSignupEnabled: boolean /** Server-derived: verification is enabled AND a mail provider is configured. */ emailVerificationEnabled: boolean @@ -101,7 +100,6 @@ function SignupFormContent({ githubAvailable, googleAvailable, microsoftAvailable, - isProduction, emailSignupEnabled, emailVerificationEnabled, }: SignupFormProps) { @@ -484,7 +482,6 @@ function SignupFormContent({ googleAvailable={googleAvailable} microsoftAvailable={microsoftAvailable} callbackURL={redirectUrl || '/workspace'} - isProduction={isProduction} > {ssoEnabled && !hasOnlySSO && ( @@ -507,7 +504,6 @@ export default function SignupPage({ githubAvailable, googleAvailable, microsoftAvailable, - isProduction, emailSignupEnabled, emailVerificationEnabled, }: SignupFormProps) { @@ -519,7 +515,6 @@ export default function SignupPage({ githubAvailable={githubAvailable} googleAvailable={googleAvailable} microsoftAvailable={microsoftAvailable} - isProduction={isProduction} emailSignupEnabled={emailSignupEnabled} emailVerificationEnabled={emailVerificationEnabled} />