Skip to content

Prevent duplicate submissions with guard flags - #899

Closed
PythonSmall-Q with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-multiple-submit-issue
Closed

PythonSmall-Q with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-multiple-submit-issue

Conversation

Copilot AI commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Clicking submit buttons once was triggering 40-50 duplicate submissions.

Changes

Added guard flags to three submission handlers:

  • Code submission (submitpage.php): isSubmitting flag prevents concurrent Submit/PassCheck operations
  • Discussion posts (newpost.php): isSubmittingPost flag guards post creation
  • Discussion replies (thread.php): isSubmittingReply flag guards reply submission

Each flag checks at handler entry and returns early if already submitting, then resets on all exit paths (validation failures, API errors, success).

let isSubmitting = false;
Submit.addEventListener("click", async () => {
    if (isSubmitting) return;
    isSubmitting = true;
    // ... validation and submission logic
    isSubmitting = false; // reset on all completion paths
});

Note: isSubmitting scoped before PassCheck handler since Submit calls PassCheck.click() programmatically after validation.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Summary by cubic

Fixes multiple submissions triggered by a single click across code submit, new post, and reply. Ensures only one request runs at a time and the UI reflects the pending state.

  • Bug Fixes
    • Add per-form submission flags (isSubmitting, isSubmittingPost, isSubmittingReply) with early-return guards.
    • Disable submit buttons and show loading during requests; reset flags on success, validation failures, and errors.

Written for commit cb60e33. Summary will update on new commits.

Co-authored-by: PythonSmall-Q <106425289+PythonSmall-Q@users.noreply.github.com>
@pull-request-size pull-request-size Bot added size/S and removed size/XS labels Feb 7, 2026
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

请向dev分支提交pull request, 本pull request将被自动关闭

@github-actions github-actions Bot closed this Feb 7, 2026
Copilot AI changed the title [WIP] Fix multiple submissions with single click Prevent duplicate submissions with guard flags Feb 7, 2026
Copilot AI requested a review from PythonSmall-Q February 7, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants