feat(bulk-duplicate): add "Create more" toggle to Deep Duplicate modal#50
feat(bulk-duplicate): add "Create more" toggle to Deep Duplicate modal#50fathiraz wants to merge 5 commits into
Conversation
- delete unused modal-factory + use-subscription-ref hooks and the unused progress-state / empty-state / section-header UI primitives (~560 LOC) - add targeted eslint-disable + reason on legit external-sync effects (fetch / timer / reset-on-prop) flagged by react-hooks/set-state-in-effect - dedupe the 3x iteration+endDate mapping in sprint-handlers via a local withEndDate helper
…siblings Split bulk-edit-flyout.tsx (717 -> 440 LOC) by moving the presentational sub-components into bulk-edit-value-picker.tsx and bulk-edit-field-row.tsx, and the DOM helper firstRepoNameFromDom into bulk-edit-flyout-helpers.ts. No behavior change; public component + props unchanged.
Move SelectSectionsStep and ReviewStep out of bulk-duplicate-modal.tsx (1490 -> 1199 LOC) into bulk-duplicate-steps.tsx. No behavior change; BulkDuplicateModal public API unchanged.
Remove the Primer components, icons, and helpers that are no longer referenced in bulk-edit-flyout.tsx / bulk-duplicate-modal.tsx after their sub-components moved to sibling modules.
There was a problem hiding this comment.
Cursor auto review
No actionable issues found on changed lines.
The Create more feature is well-structured, but rapid Duplicate clicks can bypass the 3-concurrent guard: queueStore.getActiveCount() is checked before the background worker registers the job, so extra requests are silently dropped after flyToTracker already ran.
Generated automatically when this PR was submitted using Cursor CLI with --model auto.
There was a problem hiding this comment.
1 issue found across 27 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/features/bulk-duplicate-modal.tsx">
<violation number="1" location="src/features/bulk-duplicate-modal.tsx:399">
P2: Rapid repeated clicks with Create more can silently drop duplicate requests instead of showing the 3-concurrent warning. The modal now sends `duplicateItem` without awaiting, so local active-count checks can be stale before queue broadcasts land, while background rejects extra jobs without surfacing an error; consider adding an immediate local in-flight counter (or disabling button until first queue tick) to close this race.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| await sendMessage('duplicateItem', { | ||
| // Fire-and-forget: the duplication runs to completion in the background SW | ||
| // regardless of the modal's lifecycle; errors surface via the queue tracker. | ||
| void sendMessage('duplicateItem', { |
There was a problem hiding this comment.
P2: Rapid repeated clicks with Create more can silently drop duplicate requests instead of showing the 3-concurrent warning. The modal now sends duplicateItem without awaiting, so local active-count checks can be stale before queue broadcasts land, while background rejects extra jobs without surfacing an error; consider adding an immediate local in-flight counter (or disabling button until first queue tick) to close this race.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/features/bulk-duplicate-modal.tsx, line 399:
<comment>Rapid repeated clicks with Create more can silently drop duplicate requests instead of showing the 3-concurrent warning. The modal now sends `duplicateItem` without awaiting, so local active-count checks can be stale before queue broadcasts land, while background rejects extra jobs without surfacing an error; consider adding an immediate local in-flight counter (or disabling button until first queue tick) to close this race.</comment>
<file context>
@@ -686,13 +394,23 @@ export function BulkDuplicateModal({
- await sendMessage('duplicateItem', {
+ // Fire-and-forget: the duplication runs to completion in the background SW
+ // regardless of the modal's lifecycle; errors surface via the queue tracker.
+ void sendMessage('duplicateItem', {
itemId: preview.resolvedItemId || itemId,
projectId: preview.projectId || projectId,
</file context>
Mirror GitHub's new-issue "Create more": queue a copy without leaving the modal. Checked keeps the modal open and resets edits to source defaults so the user can queue another copy of the same item; unchecked closes and hands off to the queue tracker. Also drop the blocking await in handleDuplicate so the modal no longer stays frozen until every duplication finishes — the background service worker runs the copy to completion regardless, and errors surface via the queue tracker. Extract applyPreviewDefaults() as the single source-defaults reset path, shared by the initial preview load and the Create-more re-arm.
95c28aa to
c0deeb9
Compare
Summary
awaitso the modal no longer stays frozen until every duplication finishes — the background worker runs each copy to completion regardlessChanges
Modal (
src/features/bulk-duplicate-modal.tsx)applyPreviewDefaults()as the single source-defaults reset path, shared by the initial preview load and the Create-more re-armcreateMorestate (unchecked, no persistence — resets each open)handleDuplicateto fire-and-forget theduplicateItemmessage; keep the 3-concurrent cap guard; checked re-arms the form, unchecked closesReview step (
src/features/bulk-duplicate-steps.tsx)ReviewStepgainscreateMore/onToggleCreateMorepropsCheckbox+ label in the footer beside the Duplicate button (Primer +sxonly, inside the existing Shadow DOM /ShadowThemeProvidertree)Docs (
CONTEXT.md)Test Plan
<title> (copy)defaults, modal stays open, copy flies to the queue tracker; repeat to queue severalpnpm typecheck && pnpm lint && pnpm test— 0 type errors, 0 lint errors, 415 tests passSummary by cubic
Add a Create more toggle to the Deep Duplicate modal so you can queue multiple copies without closing the modal. Duplication now runs in the background to keep the modal responsive, with progress handed off to the queue tracker.
New Features
Refactors
SelectSectionsStepandReviewSteptosrc/features/bulk-duplicate-steps.tsx. AddapplyPreviewDefaults()as the single reset path.bulk-edit-value-picker.tsxandbulk-edit-field-row.tsx; movefirstRepoNameFromDomto helpers. No behavior change.modal-factory,use-subscription-ref, and UI primitives (empty-state,progress-state,section-header) and related tests; prune orphaned imports.react-hooks/set-state-in-effecteslint-disable comments with reasons; dedupe sprint endDate mapping via a localwithEndDatehelper.Written for commit c0deeb9. Summary will update on new commits.