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.
This commit is contained in:
Waleed Latif
2026-08-24 12:37:32 -07:00
parent 331c2ed2ed
commit 110ba76df3
4 changed files with 0 additions and 11 deletions
@@ -218,7 +218,6 @@ export function usePromptEditor({
const mentionMenu = useMentionMenu({
message: value,
selectedContexts: contextManagement.selectedContexts,
onContextSelect: addContextNotified,
onMessageChange: commitValue,
})
@@ -7,8 +7,6 @@ interface UseMentionMenuProps {
message: string
/** Currently selected contexts */
selectedContexts: ChatContext[]
/** Callback when a context is selected */
onContextSelect: (context: ChatContext) => void
/** Callback when message changes */
onMessageChange: (message: string) => void
}
@@ -23,7 +21,6 @@ interface UseMentionMenuProps {
export function useMentionMenu({
message,
selectedContexts,
onContextSelect,
onMessageChange,
}: UseMentionMenuProps) {
// Refs
@@ -24,7 +24,6 @@ interface FieldItemProps {
connection: ConnectedBlock
field: SchemaField
path: string
level: number
hasChildren?: boolean
isExpanded?: boolean
onToggleExpand?: (path: string) => void
@@ -37,7 +36,6 @@ export function FieldItem({
connection,
field,
path,
level,
hasChildren,
isExpanded,
onToggleExpand,
@@ -27,7 +27,6 @@ interface ConnectionBlocksProps {
interface FieldTreeNodesProps {
fields: SchemaField[]
parentPath: string
level: number
connection: ConnectedBlock
isFieldExpanded: (connectionId: string, fieldPath: string) => boolean
onToggleFieldExpansion: (connectionId: string, fieldPath: string) => void
@@ -36,7 +35,6 @@ interface FieldTreeNodesProps {
function FieldTreeNodes({
fields,
parentPath,
level,
connection,
isFieldExpanded,
onToggleFieldExpansion,
@@ -52,7 +50,6 @@ function FieldTreeNodes({
connection={connection}
field={field}
path={fieldPath}
level={level}
hasChildren={hasChildren}
isExpanded={expanded}
onToggleExpand={(p) => onToggleFieldExpansion(connection.id, p)}
@@ -63,7 +60,6 @@ function FieldTreeNodes({
<FieldTreeNodes
fields={field.children!}
parentPath={fieldPath}
level={level + 1}
connection={connection}
isFieldExpanded={isFieldExpanded}
onToggleFieldExpansion={onToggleFieldExpansion}
@@ -152,7 +148,6 @@ function ConnectionItem({
<FieldTreeNodes
fields={fields}
parentPath=''
level={0}
connection={connection}
isFieldExpanded={isFieldExpanded}
onToggleFieldExpansion={onToggleFieldExpansion}