mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix: gate registry fetch on modal visibility, use resetFields to clear OAuth fields
This commit is contained in:
parent
36829d02ef
commit
ceccbf110f
2 changed files with 6 additions and 6 deletions
|
|
@ -37,13 +37,13 @@ const OpenAPIFormSection: React.FC<OpenAPIFormSectionProps> = ({
|
|||
updates.auth_type = AUTH_TYPE.OAUTH2;
|
||||
updates.authorization_url = entry.oauth.authorization_url;
|
||||
updates.token_url = entry.oauth.token_url;
|
||||
form.setFieldsValue(updates);
|
||||
} else {
|
||||
// Clear stale OAuth config from previous preset selection
|
||||
updates.auth_type = undefined;
|
||||
updates.authorization_url = undefined;
|
||||
updates.token_url = undefined;
|
||||
// resetFields is required to visually clear Ant Design form fields —
|
||||
// setFieldsValue with undefined silently skips undefined keys.
|
||||
form.resetFields(["auth_type", "authorization_url", "token_url"]);
|
||||
form.setFieldsValue(updates);
|
||||
}
|
||||
form.setFieldsValue(updates);
|
||||
onValuesChange(updates);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ const CreateMCPServer: React.FC<CreateMCPServerProps> = ({
|
|||
{transportType === TRANSPORT.OPENAPI && (
|
||||
<OpenAPIFormSection
|
||||
form={form}
|
||||
accessToken={accessToken}
|
||||
accessToken={isModalVisible ? accessToken : null}
|
||||
onValuesChange={(updates) =>
|
||||
setFormValues((prev) => ({ ...prev, ...updates }))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue