Refactor protocol configuration logic in server form

This commit is contained in:
Ember Moth 2025-11-02 16:48:41 +08:00 committed by GitHub
parent 705391f82a
commit 5318b9cf44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -356,7 +356,8 @@ export default function ServerForm(props: {
...initialValues,
protocols: PROTOCOLS.map((type) => {
const existingProtocol = initialValues.protocols?.find((p) => p.type === type);
return existingProtocol || getProtocolDefaultConfig(type);
const defaultConfig = getProtocolDefaultConfig(type);
return existingProtocol ? { ...defaultConfig, ...existingProtocol } : defaultConfig;
}),
});
}