Skip to content

Fix race condition in Add New Cue modal when submitting via Enter key#1215

Merged
Tim020 merged 1 commit into
devfrom
feature/fix-new-cue-modal-enter-key-race
Jun 17, 2026
Merged

Fix race condition in Add New Cue modal when submitting via Enter key#1215
Tim020 merged 1 commit into
devfrom
feature/fix-new-cue-modal-enter-key-race

Conversation

@Tim020

@Tim020 Tim020 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes a race condition where pressing Enter to submit the Add New Cue modal left it open during the API call, causing a spurious "A cue with this identifier already exists" warning to flash before the modal closed.
  • Moves newCueModal.hide() to before await scriptStore.addNewCue(...) so Enter key and OK button now both close the modal immediately on valid submission.
  • Removes the now-redundant resetNewForm() call at the end of onSubmitNew — the modal's @hidden event already calls it as a cleanup handler.

Root cause: BVN auto-closes the modal at the first await in a @ok handler, but a DOM @submit event (Enter key) has no such behaviour — the modal stayed open until hide() was called explicitly (post-await). By then, addNewCue had already run loadCues(), updating the store and briefly making isDuplicateNewCue true.

Test plan

  • Open the Cue Configuration tab in a show with an existing cue type and script line
  • Open the Add New Cue modal on a line, fill in type and identifier, press Enter
  • Confirm: modal closes immediately without flashing the duplicate warning
  • Confirm: the new cue appears on the line
  • Repeat using the OK button — behaviour should be unchanged
  • All 180 Playwright E2E tests pass (verified locally)

🤖 Generated with Claude Code

When pressing Enter to submit the modal, it stayed open during the API
call. After addNewCue resolved it called loadCues(), which updated the
store and briefly made isDuplicateNewCue true, showing a spurious
warning before hide() finally closed the modal.

Clicking OK was unaffected because BVN auto-closes the modal at the
first await in the @ok handler, before loadCues() runs.

Fix: move hide() to before the await so both paths close the modal
immediately on valid submission. resetNewForm() is removed from here
because the @hidden event already wires it as a cleanup handler.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tim020 Tim020 added the claude Issues created by Claude label Jun 17, 2026
@github-actions

Copy link
Copy Markdown

Client V3 Test Results

23 tests  ±0   23 ✅ ±0   0s ⏱️ ±0s
 2 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit d2f85ca. ± Comparison against base commit d669296.

@github-actions

Copy link
Copy Markdown

Client Test Results

128 tests  ±0   128 ✅ ±0   0s ⏱️ ±0s
  6 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit d2f85ca. ± Comparison against base commit d669296.

@sonarqubecloud

Copy link
Copy Markdown

@Tim020 Tim020 enabled auto-merge (squash) June 17, 2026 00:36
@github-actions

Copy link
Copy Markdown

Python Test Results

  1 files  ±0    1 suites  ±0   1m 49s ⏱️ -20s
662 tests ±0  662 ✅ ±0  0 💤 ±0  0 ❌ ±0 
667 runs  ±0  667 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit d2f85ca. ± Comparison against base commit d669296.

@github-actions

Copy link
Copy Markdown

Playwright E2E Results (firefox)

180 tests  ±0   180 ✅ ±0   1m 54s ⏱️ -1s
 14 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit d2f85ca. ± Comparison against base commit d669296.

@github-actions

Copy link
Copy Markdown

Playwright E2E Results (chromium)

180 tests  ±0   180 ✅ ±0   1m 51s ⏱️ -5s
 14 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit d2f85ca. ± Comparison against base commit d669296.

@Tim020 Tim020 merged commit 73e96d0 into dev Jun 17, 2026
35 checks passed
@Tim020 Tim020 deleted the feature/fix-new-cue-modal-enter-key-race branch June 17, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Issues created by Claude client-v3 xsmall-diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant