Repository navigation
fix(tasks): prevent duplicate Add Task submissions while a request is pending - #486
Open
WiseShrestha wants to merge 1 commit into
Open
WiseShrestha wants to merge 1 commit into
WiseShrestha wants to merge 1 commit into
Conversation
… pending The Add Task button called onSubmit on every click, so clicking it again before the backend responded sent the same task more than once. The dialog now tracks the pending submission when onSubmit returns a promise: further clicks are ignored, and the button is disabled and shows "Adding..." until the request settles. A ref blocks a second click that lands before React re-renders. Fixes CCExtractor#482 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013TjiucazWUjDoYj1dsAmKB
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Clicking Add Task again before the backend responded sent the same task more than once, because the button called
onSubmiton every click without waiting.The dialog now tracks the pending submission when
onSubmitreturns a promise:aria-busyis set too)AddTaskDialogProps.onSubmitis now typed(task) => void | Promise<void>, which matches the existing asynchandleAddTaskinTasks.tsx. A synchronousonSubmitbehaves as before.Checklist
npx prettier --checkreports them as formatted)gofmt -w .(for Go backend): not applicable, no Go changesnpm test(for JS/TS testing): 59 suites, 754 tests passAdditional Notes
AddTaskDialog.test.tsx: one checks that clicks during a pending submission are ignored and the button is disabled; the other checks that the button works again once the submission settles. The first test fails against the old code.tsc --noEmitis clean.