🐛 fix(auth): prevent duplicate “session expired” toast on login

Login Form used to display the message “未登录或登录已过期,请重新登录” twice
because the `useEffect` that inspects the `expired` query parameter was
re-executed on every re-render (e.g. language change or React StrictMode’s
double-mount in development).

### What's changed
• **LoginForm.js** – `useEffect` that shows the toast now has an empty
  dependency array so it runs only once on initial mount.
• Reviewed **PasswordResetConfirm.js**, **PasswordResetForm.js** and
  **RegisterForm.js** and confirmed they do not contain the same issue;
  no changes were required.

### Impact
Users now see the “session expired” notification exactly once, removing
confusion and improving the overall UX.
This commit is contained in:
t0ng7u
2025-06-26 03:51:19 +08:00
parent 6935260bf0
commit 86f374df58

View File

@@ -84,7 +84,7 @@ const LoginForm = () => {
if (searchParams.get('expired')) {
showError(t('未登录或登录已过期,请重新登录'));
}
}, [searchParams, t]);
}, []);
const onWeChatLoginClicked = () => {
setWechatLoading(true);