Skip to content

Commit 56e8518

Browse files
committed
refactor(auth): drop the isProduction prop nothing on the signin path reads
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`. (cherry picked from commit 331c2ed)
1 parent 445ef62 commit 56e8518

6 files changed

Lines changed: 3 additions & 18 deletions

File tree

apps/sim/app/(auth)/components/oauth-provider-checker.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
isGithubAuthDisabled,
44
isGoogleAuthDisabled,
55
isMicrosoftAuthDisabled,
6-
isProd,
76
} from '@/lib/core/config/env-flags'
87

98
export async function getOAuthProviderStatus() {
@@ -16,5 +15,5 @@ export async function getOAuthProviderStatus() {
1615
const microsoftAvailable =
1716
!!(env.MICROSOFT_CLIENT_ID && env.MICROSOFT_CLIENT_SECRET) && !isMicrosoftAuthDisabled
1817

19-
return { githubAvailable, googleAvailable, microsoftAvailable, isProduction: isProd }
18+
return { githubAvailable, googleAvailable, microsoftAvailable }
2019
}

apps/sim/app/(auth)/components/social-login-buttons.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ interface SocialLoginButtonsProps {
1515
googleAvailable: boolean
1616
microsoftAvailable: boolean
1717
callbackURL?: string
18-
isProduction: boolean
1918
children?: ReactNode
2019
}
2120

@@ -24,7 +23,6 @@ export function SocialLoginButtons({
2423
googleAvailable,
2524
microsoftAvailable,
2625
callbackURL = '/workspace',
27-
isProduction,
2826
children,
2927
}: SocialLoginButtonsProps) {
3028
const [isGithubLoading, setIsGithubLoading] = useState(false)

apps/sim/app/(auth)/login/login-form.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ export default function LoginPage({
8787
githubAvailable,
8888
googleAvailable,
8989
microsoftAvailable,
90-
isProduction,
9190
registrationDisabled,
9291
}: {
9392
githubAvailable: boolean
9493
googleAvailable: boolean
9594
microsoftAvailable: boolean
96-
isProduction: boolean
9795
/** DISABLE_REGISTRATION. Hides the signup cross-link, which `/signup` blocks. */
9896
registrationDisabled: boolean
9997
}) {
@@ -430,7 +428,6 @@ export default function LoginPage({
430428
googleAvailable={googleAvailable}
431429
githubAvailable={githubAvailable}
432430
microsoftAvailable={microsoftAvailable}
433-
isProduction={isProduction}
434431
callbackURL={callbackUrl}
435432
>
436433
{ssoEnabled && !hasOnlySSO && (

apps/sim/app/(auth)/login/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ export const metadata: Metadata = {
1212
export const dynamic = 'force-dynamic'
1313

1414
export default async function LoginPage() {
15-
const { githubAvailable, googleAvailable, microsoftAvailable, isProduction } =
16-
await getOAuthProviderStatus()
15+
const { githubAvailable, googleAvailable, microsoftAvailable } = await getOAuthProviderStatus()
1716

1817
return (
1918
<Suspense fallback={<LoginLoading />}>
2019
<LoginForm
2120
githubAvailable={githubAvailable}
2221
googleAvailable={googleAvailable}
2322
microsoftAvailable={microsoftAvailable}
24-
isProduction={isProduction}
2523
registrationDisabled={isRegistrationDisabled}
2624
/>
2725
</Suspense>

apps/sim/app/(auth)/signup/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ export default async function SignupPage({
3636
)
3737
}
3838

39-
const { githubAvailable, googleAvailable, microsoftAvailable, isProduction } =
40-
await getOAuthProviderStatus()
39+
const { githubAvailable, googleAvailable, microsoftAvailable } = await getOAuthProviderStatus()
4140

4241
return (
4342
<SignupForm
4443
githubAvailable={githubAvailable}
4544
googleAvailable={googleAvailable}
4645
microsoftAvailable={microsoftAvailable}
47-
isProduction={isProduction}
4846
emailSignupEnabled={!isEmailSignupDisabled}
4947
emailVerificationEnabled={isEmailVerificationEffectivelyEnabled()}
5048
/>

apps/sim/app/(auth)/signup/signup-form.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ interface SignupFormProps {
9191
githubAvailable: boolean
9292
googleAvailable: boolean
9393
microsoftAvailable: boolean
94-
isProduction: boolean
9594
emailSignupEnabled: boolean
9695
/** Server-derived: verification is enabled AND a mail provider is configured. */
9796
emailVerificationEnabled: boolean
@@ -101,7 +100,6 @@ function SignupFormContent({
101100
githubAvailable,
102101
googleAvailable,
103102
microsoftAvailable,
104-
isProduction,
105103
emailSignupEnabled,
106104
emailVerificationEnabled,
107105
}: SignupFormProps) {
@@ -484,7 +482,6 @@ function SignupFormContent({
484482
googleAvailable={googleAvailable}
485483
microsoftAvailable={microsoftAvailable}
486484
callbackURL={redirectUrl || '/workspace'}
487-
isProduction={isProduction}
488485
>
489486
{ssoEnabled && !hasOnlySSO && (
490487
<SSOLoginButton callbackURL={redirectUrl || '/workspace'} variant='outline' />
@@ -507,7 +504,6 @@ export default function SignupPage({
507504
githubAvailable,
508505
googleAvailable,
509506
microsoftAvailable,
510-
isProduction,
511507
emailSignupEnabled,
512508
emailVerificationEnabled,
513509
}: SignupFormProps) {
@@ -519,7 +515,6 @@ export default function SignupPage({
519515
githubAvailable={githubAvailable}
520516
googleAvailable={googleAvailable}
521517
microsoftAvailable={microsoftAvailable}
522-
isProduction={isProduction}
523518
emailSignupEnabled={emailSignupEnabled}
524519
emailVerificationEnabled={emailVerificationEnabled}
525520
/>

0 commit comments

Comments
 (0)