From 49c30d6baf5d422f694e45b3ca3d451693ba9d63 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Mon, 1 Jun 2026 00:49:44 +0200 Subject: [PATCH] fix(frontend): add missing react-hooks/exhaustive-deps ESLint failed the frontend build on four react-hooks/exhaustive-deps errors. Add the missing dependencies: the hysteria streamSettings effect now lists form, and the inbounds page prompt/import/general-action callbacks now list t. Both form (Form.useForm) and t (useTranslation) are stable references, so no extra re-renders or loops. --- frontend/src/pages/inbounds/InboundsPage.tsx | 6 +++--- frontend/src/pages/xray/outbounds/OutboundFormModal.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/inbounds/InboundsPage.tsx b/frontend/src/pages/inbounds/InboundsPage.tsx index a63a4d05..459c6b92 100644 --- a/frontend/src/pages/inbounds/InboundsPage.tsx +++ b/frontend/src/pages/inbounds/InboundsPage.tsx @@ -176,7 +176,7 @@ export default function InboundsPage() { setPromptInitial(opts.value || ''); setPromptHandler(() => opts.confirm); setPromptOpen(true); - }, []); + }, [t]); const onPromptConfirm = useCallback(async (value: string) => { if (!promptHandler) { @@ -329,7 +329,7 @@ export default function InboundsPage() { return false; }, }); - }, [openPrompt, refresh]); + }, [openPrompt, refresh, t]); const onAddInbound = useCallback(() => { setFormMode('add'); @@ -476,7 +476,7 @@ export default function InboundsPage() { default: messageApi.info(`General action "${key}" — coming in a later 5f subphase`); } - }, [modal, importInbound, exportAllLinks, exportAllSubs, refresh, messageApi]); + }, [modal, importInbound, exportAllLinks, exportAllSubs, refresh, messageApi, t]); const onRowAction = useCallback(async ({ key, dbInbound }: { key: RowAction; dbInbound: DBInbound }) => { // Actions that touch per-client secrets (uuid, password, flow, ...) need diff --git a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx index 51f3bb73..887f7ce4 100644 --- a/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx +++ b/frontend/src/pages/xray/outbounds/OutboundFormModal.tsx @@ -168,7 +168,7 @@ export default function OutboundFormModal({ if (existing.hysteriaSettings) slice.hysteriaSettings = existing.hysteriaSettings; if (existing.tlsSettings) slice.tlsSettings = existing.tlsSettings; form.setFieldValue('streamSettings', slice); - }, [protocol, network, security]); + }, [protocol, network, security, form]); const wgSecretKey = Form.useWatch(['settings', 'secretKey'], form) as string | undefined; useEffect(() => {