mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 12:44:22 +00:00
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.
This commit is contained in:
parent
61ba5754ca
commit
49c30d6baf
2 changed files with 4 additions and 4 deletions
|
|
@ -176,7 +176,7 @@ export default function InboundsPage() {
|
||||||
setPromptInitial(opts.value || '');
|
setPromptInitial(opts.value || '');
|
||||||
setPromptHandler(() => opts.confirm);
|
setPromptHandler(() => opts.confirm);
|
||||||
setPromptOpen(true);
|
setPromptOpen(true);
|
||||||
}, []);
|
}, [t]);
|
||||||
|
|
||||||
const onPromptConfirm = useCallback(async (value: string) => {
|
const onPromptConfirm = useCallback(async (value: string) => {
|
||||||
if (!promptHandler) {
|
if (!promptHandler) {
|
||||||
|
|
@ -329,7 +329,7 @@ export default function InboundsPage() {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}, [openPrompt, refresh]);
|
}, [openPrompt, refresh, t]);
|
||||||
|
|
||||||
const onAddInbound = useCallback(() => {
|
const onAddInbound = useCallback(() => {
|
||||||
setFormMode('add');
|
setFormMode('add');
|
||||||
|
|
@ -476,7 +476,7 @@ export default function InboundsPage() {
|
||||||
default:
|
default:
|
||||||
messageApi.info(`General action "${key}" — coming in a later 5f subphase`);
|
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 }) => {
|
const onRowAction = useCallback(async ({ key, dbInbound }: { key: RowAction; dbInbound: DBInbound }) => {
|
||||||
// Actions that touch per-client secrets (uuid, password, flow, ...) need
|
// Actions that touch per-client secrets (uuid, password, flow, ...) need
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ export default function OutboundFormModal({
|
||||||
if (existing.hysteriaSettings) slice.hysteriaSettings = existing.hysteriaSettings;
|
if (existing.hysteriaSettings) slice.hysteriaSettings = existing.hysteriaSettings;
|
||||||
if (existing.tlsSettings) slice.tlsSettings = existing.tlsSettings;
|
if (existing.tlsSettings) slice.tlsSettings = existing.tlsSettings;
|
||||||
form.setFieldValue('streamSettings', slice);
|
form.setFieldValue('streamSettings', slice);
|
||||||
}, [protocol, network, security]);
|
}, [protocol, network, security, form]);
|
||||||
|
|
||||||
const wgSecretKey = Form.useWatch(['settings', 'secretKey'], form) as string | undefined;
|
const wgSecretKey = Form.useWatch(['settings', 'secretKey'], form) as string | undefined;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue