Browse Source

🐛 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.
t0ng7u 6 months ago
parent
commit
86f374df58
1 changed files with 1 additions and 1 deletions
  1. 1 1
      web/src/components/auth/LoginForm.js

+ 1 - 1
web/src/components/auth/LoginForm.js

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