Skip to content

Commit aba6811

Browse files
authored
refactor: remove five more dead prop chains (#7046)
* 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) * refactor: drop two more props declared, threaded, and never read Same shape as the two already in this PR, found by sweeping the rest of the unused-parameter list for params callers actively compute and pass. `FieldItem.level` is the worse of the two. It is a required `level: number` that the component never reads, and `FieldTreeNodes` exists to thread it: declared, destructured, handed to `FieldItem`, and incremented on every recursion (`level={level + 1}`) from a `level={0}` seed. So a depth counter was carried through an arbitrarily deep tree to feed a component that ignores it. Indentation comes from the nested wrapper divs (`ml-1.5 pl-2.5`, `ml-3 pl-2.5`), not from the counter — removing it changes no rendering. `useMentionMenu`'s `onContextSelect` is a required prop carrying the TSDoc "Callback when a context is selected". The hook never invokes it, so that contract is unimplemented and a future caller would reasonably rely on it. Only the dead hand-off goes there. `addContextNotified` stays: the caller invokes it directly at five sites, and the ref sinks behind it keep its identity stable for those. Context selection has always worked because the caller does the work itself, not because the hook calls back. (cherry picked from commit 110ba76) * refactor: drop two more dead prop chains in the sub-block editor `GroupedCheckboxList` declares `title` (required) and `maxHeight` and reads neither. It renders its own hardcoded copy instead — `Select PII Types to Detect` for the header and `PII types` for the field label — so a block author who sets `title` on a `grouped-checkbox-list` subBlock gets silence, and the `maxHeight = 400` default implies a scroll ceiling that is never applied. Both props go, along with the two values `sub-block.tsx` was passing. `flatTagList` was threaded through the recursive tag renderers to a dead end: declared on `NestedTagRendererProps`, inherited by `FolderContentsProps`, destructured in both, forwarded once more, and read by neither. Its real consumer is `flatTagIndexMap`, built from it at the top level and documented "Map from tag string to index for O(1) lookups" — so the array was being carried alongside its own index through arbitrary nesting depth. The top-level memo and its length checks stay; only the descent goes. Note the component's copy is PII-specific while its name and props present as generic. Renaming it is a separate call, not made here. Both removals were caught mid-flight by `tsc`: my line patterns also matched a live `flatTagList` on `KeyboardNavigationHandler` and a live `title` on `Switch`, which is exactly why the type-check runs before the commit and not after. (cherry picked from commit 5db44f3) * refactor(custom-blocks): drop the workspaceId three mutation hooks never use `usePublishCustomBlock`, `useUpdateCustomBlock` and `useDeleteCustomBlock` each take `workspaceId?: string` and never read it. `custom-block-detail.tsx` passes it to all three. The parameter looks like it was meant to narrow the invalidation to `customBlockKeys.list(workspaceId)`, but `lists()` is the level CLAUDE.md's targeted-invalidation rule actually prescribes, and it is a correct superset. So the invalidation is right as written and the parameter is simply vestigial — removing it is the honest fix, and narrowing the key would be a separate call with its own risk of under-invalidating. Worth recording that these three were reported to me as having zero callers and therefore being dead exports. They are not: the search that produced that claim omitted `apps/sim/ee`, where all three are used. (cherry picked from commit 2d0854a)
1 parent 445ef62 commit aba6811

15 files changed

Lines changed: 10 additions & 47 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
/>

apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/use-prompt-editor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ export function usePromptEditor({
218218
const mentionMenu = useMentionMenu({
219219
message: value,
220220
selectedContexts: contextManagement.selectedContexts,
221-
onContextSelect: addContextNotified,
222221
onMessageChange: commitValue,
223222
})
224223

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-menu.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ interface UseMentionMenuProps {
77
message: string
88
/** Currently selected contexts */
99
selectedContexts: ChatContext[]
10-
/** Callback when a context is selected */
11-
onContextSelect: (context: ChatContext) => void
1210
/** Callback when message changes */
1311
onMessageChange: (message: string) => void
1412
}
@@ -23,7 +21,6 @@ interface UseMentionMenuProps {
2321
export function useMentionMenu({
2422
message,
2523
selectedContexts,
26-
onContextSelect,
2724
onMessageChange,
2825
}: UseMentionMenuProps) {
2926
// Refs

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/connection-blocks/components/field-item/field-item.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ interface FieldItemProps {
2424
connection: ConnectedBlock
2525
field: SchemaField
2626
path: string
27-
level: number
2827
hasChildren?: boolean
2928
isExpanded?: boolean
3029
onToggleExpand?: (path: string) => void
@@ -37,7 +36,6 @@ export function FieldItem({
3736
connection,
3837
field,
3938
path,
40-
level,
4139
hasChildren,
4240
isExpanded,
4341
onToggleExpand,

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/connection-blocks/connection-blocks.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ interface ConnectionBlocksProps {
2727
interface FieldTreeNodesProps {
2828
fields: SchemaField[]
2929
parentPath: string
30-
level: number
3130
connection: ConnectedBlock
3231
isFieldExpanded: (connectionId: string, fieldPath: string) => boolean
3332
onToggleFieldExpansion: (connectionId: string, fieldPath: string) => void
@@ -36,7 +35,6 @@ interface FieldTreeNodesProps {
3635
function FieldTreeNodes({
3736
fields,
3837
parentPath,
39-
level,
4038
connection,
4139
isFieldExpanded,
4240
onToggleFieldExpansion,
@@ -52,7 +50,6 @@ function FieldTreeNodes({
5250
connection={connection}
5351
field={field}
5452
path={fieldPath}
55-
level={level}
5653
hasChildren={hasChildren}
5754
isExpanded={expanded}
5855
onToggleExpand={(p) => onToggleFieldExpansion(connection.id, p)}
@@ -63,7 +60,6 @@ function FieldTreeNodes({
6360
<FieldTreeNodes
6461
fields={field.children!}
6562
parentPath={fieldPath}
66-
level={level + 1}
6763
connection={connection}
6864
isFieldExpanded={isFieldExpanded}
6965
onToggleFieldExpansion={onToggleFieldExpansion}
@@ -152,7 +148,6 @@ function ConnectionItem({
152148
<FieldTreeNodes
153149
fields={fields}
154150
parentPath=''
155-
level={0}
156151
connection={connection}
157152
isFieldExpanded={isFieldExpanded}
158153
onToggleFieldExpansion={onToggleFieldExpansion}

0 commit comments

Comments
 (0)