🛡️ fix: Add Null Checks to Parameter Settings to Prevent Undefined Access (#9108)

Fixes "Cannot read properties of undefined (reading 'key')" error in parameter panels by filtering out null/undefined values before mapping operations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Andrés Restrepo 2025-08-19 10:12:30 -05:00 committed by GitHub
parent b9bc3123d6
commit beff848a3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View file

@ -79,9 +79,9 @@ export default function ModelPanel({
agentParamSettings[combinedKey] ?? agentParamSettings[overriddenEndpointKey] ?? [];
const overriddenParams = endpointsConfig[provider]?.customParams?.paramDefinitions ?? [];
const overriddenParamsMap = keyBy(overriddenParams, 'key');
return defaultParams.map(
(param) => (overriddenParamsMap[param.key] as SettingDefinition) ?? param,
);
return defaultParams
.filter((param) => param != null)
.map((param) => (overriddenParamsMap[param.key] as SettingDefinition) ?? param);
}, [endpointType, endpointsConfig, model, provider]);
const setOption = (optionKey: keyof t.AgentModelParameters) => (value: t.AgentParameterValue) => {