From 7100e11cde53bc80243b4ca313434641766e9f17 Mon Sep 17 00:00:00 2001 From: pratyushsawan Date: Sun, 3 Nov 2024 10:34:40 +0530 Subject: [PATCH 1/3] fixes-#3235:userName_dup_check --- client/modules/User/components/SignupForm.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index 75ab6910e..2f80a595d 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -25,8 +25,12 @@ function asyncValidate(fieldToValidate, value) { }); } +let timeoutId; function validateUsername(username) { - return asyncValidate('username', username); + clearTimeout(timeoutId); + timeoutId = setTimeout(() => { + asyncValidate('username', username); + }, 500); } function validateEmail(email) { From c3dd550684dfbeccc3af8cda69d26d30f4e9b2f8 Mon Sep 17 00:00:00 2001 From: pratyushsawan Date: Sun, 3 Nov 2024 14:57:15 +0530 Subject: [PATCH 2/3] added timeout for email input as well --- client/modules/User/components/SignupForm.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index 2f80a595d..9578f6707 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -34,7 +34,10 @@ function validateUsername(username) { } function validateEmail(email) { - return asyncValidate('email', email); + clearTimeout(timeoutId); + timeoutId = setTimeout(() => { + asyncValidate('email', email); + }, 500); } function SignupForm() { From 41dea704a965ec3b8639c4a39ed7cfcdf4cd572c Mon Sep 17 00:00:00 2001 From: pratyushsawan Date: Sat, 23 Nov 2024 21:21:04 +0530 Subject: [PATCH 3/3] updated/added different timeout var fro email and userName --- client/modules/User/components/SignupForm.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/modules/User/components/SignupForm.jsx b/client/modules/User/components/SignupForm.jsx index 9578f6707..2070808a8 100644 --- a/client/modules/User/components/SignupForm.jsx +++ b/client/modules/User/components/SignupForm.jsx @@ -25,17 +25,19 @@ function asyncValidate(fieldToValidate, value) { }); } -let timeoutId; +let timeoutUsername; +let timeoutEmail; + function validateUsername(username) { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => { + clearTimeout(timeoutUsername); + timeoutUsername = setTimeout(() => { asyncValidate('username', username); }, 500); } function validateEmail(email) { - clearTimeout(timeoutId); - timeoutId = setTimeout(() => { + clearTimeout(timeoutEmail); + timeoutEmail = setTimeout(() => { asyncValidate('email', email); }, 500); }