Skip to content

Conversation

@nucleogenesis
Copy link
Member

@nucleogenesis nucleogenesis commented Jul 8, 2025

Summary

When a user double-clicks the Submit button during account creation, the subsequent requests after the first cause a database error as reported in #4779

This introduces a simple data property submitting to track if the user has submitted the form and ensures it is unset when an error occurs, reenabling the submit button.

References

Closes #4779

Reviewer guidance

1

  • Open Dev Tools > Networking tab > [Filter to xhr]
  • Double click the Submit button while making an account and you should only see one request made.

2

  • Start over
  • Trigger errors while filling out the form, then click Submit while the errors are present
  • Fix the errors
  • Click Submit and expect success

@nucleogenesis nucleogenesis requested review from bjester and Copilot July 8, 2025 00:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR prevents users from accidentally submitting the registration form multiple times by introducing a submitting flag and guarding the submit() method.

  • Adds a submitting data property to track in‐flight submissions
  • Early‐exit in submit() if a submission is already in progress
  • Resets submitting on error and after the submit logic

Comment on lines +494 to +499
this.submitting = false;
});
} else if (this.$refs.top.scrollIntoView) {
this.$refs.top.scrollIntoView({ behavior: 'smooth' });
}
this.submitting = false;
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resetting submitting immediately after dispatch call (outside of its promise handlers) allows the button to re-enable before the request completes. Move this reset into a finally block on the dispatch promise or remove this unconditional reset so the flag only clears after success or failure.

Suggested change
this.submitting = false;
});
} else if (this.$refs.top.scrollIntoView) {
this.$refs.top.scrollIntoView({ behavior: 'smooth' });
}
this.submitting = false;
})
.finally(() => {
this.submitting = false;
});
} else if (this.$refs.top.scrollIntoView) {
this.$refs.top.scrollIntoView({ behavior: 'smooth' });
}

Copilot uses AI. Check for mistakes.
this.$refs.top.scrollIntoView({ behavior: 'smooth' });
}
this.submitting = false;
return Promise.resolve();
Copy link

Copilot AI Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning Promise.resolve() prevents callers from awaiting the actual registration request. Instead, return the this.$store.dispatch(...) promise (chained with .finally(...)) so consumers can rely on the real submission lifecycle.

Suggested change
return Promise.resolve();
return Promise.reject(new Error('Validation failed or agreement not accepted'));

Copilot uses AI. Check for mistakes.
@rtibbles
Copy link
Member

From the issue:

We should have proper defensive checks on user creation such that attempting to create a user with a duplicate email address doesn't fail and produce a 500 error.

Need to add backend changes here to achieve the above, and also add a regression test for this behaviour.

@rtibbles
Copy link
Member

Original issue has been unassigned, so going to close this for now.

@rtibbles rtibbles closed this Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants