mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-30 19:32:46 +08:00
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`.
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
@@ -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 (
|
||||
<Suspense fallback={<LoginLoading />}>
|
||||
@@ -21,7 +20,6 @@ export default async function LoginPage() {
|
||||
githubAvailable={githubAvailable}
|
||||
googleAvailable={googleAvailable}
|
||||
microsoftAvailable={microsoftAvailable}
|
||||
isProduction={isProduction}
|
||||
registrationDisabled={isRegistrationDisabled}
|
||||
/>
|
||||
</Suspense>
|
||||
|
||||
@@ -36,15 +36,13 @@ export default async function SignupPage({
|
||||
)
|
||||
}
|
||||
|
||||
const { githubAvailable, googleAvailable, microsoftAvailable, isProduction } =
|
||||
await getOAuthProviderStatus()
|
||||
const { githubAvailable, googleAvailable, microsoftAvailable } = await getOAuthProviderStatus()
|
||||
|
||||
return (
|
||||
<SignupForm
|
||||
githubAvailable={githubAvailable}
|
||||
googleAvailable={googleAvailable}
|
||||
microsoftAvailable={microsoftAvailable}
|
||||
isProduction={isProduction}
|
||||
emailSignupEnabled={!isEmailSignupDisabled}
|
||||
emailVerificationEnabled={isEmailVerificationEffectivelyEnabled()}
|
||||
/>
|
||||
|
||||
@@ -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 && (
|
||||
<SSOLoginButton callbackURL={redirectUrl || '/workspace'} variant='outline' />
|
||||
@@ -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}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user