Repository navigation
fix(csv-import): prevent duplicate onImport calls in CSV wizards - #965
Open
Micheal1605 wants to merge 1 commit into
Open
Micheal1605 wants to merge 1 commit into
Micheal1605 wants to merge 1 commit into
Conversation
|
@Micheal1605 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Overview
This PR fixes a duplicate-import bug in the Revenue Calendar and Blacklist CSV import wizards. Both components bound the same
handleConfirmcallback to the Preview step's "Import" button and the Confirm step's "Confirm Import" button, soonImportfired once on Preview and again on Confirm — committing every row twice. The fix splits the callback into a side-effect-freegoToConfirm(Preview) and a guardedcommitImport(Confirm), soonImportruns exactly once per completed wizard run.Related Issue
Changes
🐛 CSV Import Wizard Fix
[MODIFY]
src/components/RevenueCalendarCsvImport.tsxhandleConfirmintogoToConfirm(Preview button — advances to Confirm, no side effects) andcommitImport(Confirm button — callsonImport(cleanRows)).isCommitting/committedguard so double-clicks or Enter-repeat cannot invokeonImportmore than once; the Confirm button is disabled while committing.[MODIFY]
src/components/BlacklistCsvImport.tsxhandleConfirmflow, with the PreviewImportbutton wired togoToConfirmand the Confirm step wired tocommitImport.[MODIFY]
src/components/RevenueCalendarCsvImport.test.tsxonImport; Confirm calls it once; double-click on Confirm still calls it once.[MODIFY]
src/components/BlacklistCsvImport.test.tsxVerification Results
onImportis called exactly once per completed wizard run in both componentsgoToConfirm/commitImportwith commit guardmasterand passes after the fixCloses #912