From 3716bdb06d6d764a0b1c600da937c7db50680d3b Mon Sep 17 00:00:00 2001 From: YinMo19 Date: Tue, 10 Feb 2026 13:13:40 +0800 Subject: [PATCH] fix(proxy): clear plugin data when plugin toggle is off --- www/components/frpc/proxy_form.tsx | 68 ++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/www/components/frpc/proxy_form.tsx b/www/components/frpc/proxy_form.tsx index 028a13d3..d843202b 100644 --- a/www/components/frpc/proxy_form.tsx +++ b/www/components/frpc/proxy_form.tsx @@ -146,7 +146,13 @@ export const TCPProxyForm: React.FC = ({ const [pluginConfig, setPluginConfig] = useState(defaultConfig.plugin) const onSubmit = async (values: z.infer) => { - const cfgToSubmit = { ...defaultConfig, ...values, plugin: pluginConfig, type: 'tcp', name: proxyName } as TCPProxyConfig + const cfgToSubmit = { + ...defaultConfig, + ...values, + plugin: usePlugin ? pluginConfig : undefined, + type: 'tcp', + name: proxyName, + } as TCPProxyConfig if (!TypedProxyConfigValid(cfgToSubmit)) { toast.error('Invalid configuration') return @@ -211,10 +217,15 @@ export const TCPProxyForm: React.FC = ({ name="usePlugin" label={t('proxy.form.use_plugin')} defaultValue={usePlugin} - setValue={setUsePlugin} + setValue={(value) => { + setUsePlugin(value) + if (!value) { + setPluginConfig(undefined) + } + }} /> {usePlugin ? ( - + ) : null}