🐛 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:
@@ -84,7 +84,7 @@ const LoginForm = () => {
|
||||
if (searchParams.get('expired')) {
|
||||
showError(t('未登录或登录已过期,请重新登录'));
|
||||
}
|
||||
}, [searchParams, t]);
|
||||
}, []);
|
||||
|
||||
const onWeChatLoginClicked = () => {
|
||||
setWechatLoading(true);
|
||||
|
||||
Reference in New Issue
Block a user