mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 04:42:39 +02:00
fix: avoid stale event reference in register page retry action
Extract submission logic into submitForm() so the retry toast action does not capture the original SyntheticEvent, which may be recycled by React by the time the user clicks retry. Closes #945
This commit is contained in:
parent
a474c4651c
commit
e9c51a9fba
1 changed files with 5 additions and 2 deletions
|
|
@ -43,9 +43,12 @@ export default function RegisterPage() {
|
|||
}
|
||||
}, [router]);
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
const handleSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
submitForm();
|
||||
};
|
||||
|
||||
const submitForm = async () => {
|
||||
// Form validation
|
||||
if (password !== confirmPassword) {
|
||||
setError({ title: t("password_mismatch"), message: t("passwords_no_match_desc") });
|
||||
|
|
@ -140,7 +143,7 @@ export default function RegisterPage() {
|
|||
if (shouldRetry(errorCode)) {
|
||||
toastOptions.action = {
|
||||
label: tCommon("retry"),
|
||||
onClick: () => handleSubmit(e),
|
||||
onClick: () => submitForm(),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue