Skip to content

Commit 02fa14c

Browse files
refactor: avoid reassigning the renderFormFields schema parameter
renderFormFields reassigned its `propSchema` parameter (both for normalizeUnionType and the description trim). Rename the parameter to `rawSchema` and bind a local `propSchema` instead, so the incoming parameter is never mutated. Pure refactor; no behavior change. Addresses review item modelcontextprotocol#4 on modelcontextprotocol#1258. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
1 parent 28cd2a2 commit 02fa14c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎client/src/components/DynamicJsonForm.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
300300
}));
301301

302302
const renderFormFields = (
303-
propSchema: JsonSchemaType,
303+
rawSchema: JsonSchemaType,
304304
currentValue: JsonValue,
305305
path: string[] = [],
306306
depth: number = 0,
@@ -309,7 +309,7 @@ const DynamicJsonForm = forwardRef<DynamicJsonFormRef, DynamicJsonFormProps>(
309309
) => {
310310
// Unwrap Optional[X] / nullable unions (anyOf: [X, null]) before ANY type checks
311311
// so that maxDepth enforcement and the type switch both see the real type.
312-
propSchema = normalizeUnionType(propSchema);
312+
let propSchema = normalizeUnionType(rawSchema);
313313

314314
// Trim description to remove leading/trailing whitespace from multi-line
315315
// Python triple-quoted strings (e.g. """\n - text\n """)

0 commit comments

Comments
 (0)