-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
The form submission logic in index.ts:20-32 has both a callback AND a setTimeout, which could result in duplicate submissions if the callback executes quickly.
Current code:
plausible.trackEvent("signup", {
callback: () => {
formElement.submit(); // Submit #1
},
props,
});
setTimeout(() => {
formElement.submit(); // Submit #2 (after 500ms)
}, 500);Impact
Users might receive duplicate emails or create duplicate records in the system.
Recommendation
Remove the redundant setTimeout or add a flag to prevent double submission:
let submitted = false;
plausible.trackEvent("signup", {
callback: () => {
if (!submitted) {
submitted = true;
formElement.submit();
}
},
props,
});
setTimeout(() => {
if (!submitted) {
submitted = true;
formElement.submit();
}
}, 500);This ensures the form is only submitted once, either when the tracking callback fires or after 500ms timeout.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels