Skip to content

Commit e14c80e

Browse files
committed
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)
1 parent 56e8518 commit e14c80e

4 files changed

Lines changed: 0 additions & 11 deletions

File tree

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)