Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Fix submission button stuck in initial state during API call#104

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-submission-button-processing
Draft

Fix submission button stuck in initial state during API call#104
Copilot wants to merge 3 commits intomainfrom
copilot/fix-submission-button-processing

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 1, 2025

The submit button never transitioned to a processing state, leaving users uncertain if their submission was accepted. Multiple clicks could trigger duplicate API calls.

Changes

  • Added isSubmitting state to track submission lifecycle
  • Updated submitApplication function:
    • Guard against duplicate submissions with early return
    • Set button to processing state before API call
    • Added try-catch to handle network errors
    • Reset state on failure to allow retry
  • Updated button disabled logic to include isSubmitting check
async function submitApplication() {
  if (isSubmitting) return
  
  setIsSubmitting(true)
  setSubmitButton(`⏳ ${returnLocalizedMessage(router.locale, 'PROCESSING')}`)
  
  try {
    const submissionAPICall = await fetch(/*...*/)
    // Handle success/error and reset state on failure
  } catch (error) {
    setSubmitButton(`❌ ${returnLocalizedMessage(router.locale, 'ERROR')}`)
    setIsSubmitting(false)
  }
}

Button now properly transitions: Initial → Processing → Success/Error


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
apply Ready Ready Preview Comment Nov 1, 2025 10:09pm

Co-authored-by: jeninh <213250321+jeninh@users.noreply.github.com>
Co-authored-by: jeninh <213250321+jeninh@users.noreply.github.com>
@leowilkin
Copy link
Copy Markdown
Member

Copilot AI changed the title [WIP] Fix submission button stuck on processing state Fix submission button stuck in initial state during API call Nov 1, 2025
Copilot AI requested a review from jeninh November 1, 2025 22:11
@alf1e
Copy link
Copy Markdown

alf1e commented Nov 1, 2025

bad AI, didnt fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants