fix(dataset): disable duplicate button when name is empty#42217
fix(dataset): disable duplicate button when name is empty#42217suvankardas216 wants to merge 1 commit into
Conversation
Code Review Agent Run #be40f2Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #42217 +/- ##
=======================================
Coverage 65.19% 65.19%
=======================================
Files 2768 2768
Lines 156081 156082 +1
Branches 35719 35719
=======================================
+ Hits 101754 101755 +1
Misses 52365 52365
Partials 1962 1962
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Thanks @suvankardas216, LGTM!
One thing worth a look: onPressEnter still fires onDuplicate unconditionally, so hitting Enter in the empty field bypasses the disabled button. Same bug through a different door. Happy to see it fixed here or in a follow-up, though this does seem like a good time to handle it ;)
Fixes #40405
Summary
This PR fixes an issue where the Duplicate button is enabled when the Duplicate Dataset modal is first opened, even though the dataset name is empty.
Root Cause
disableSavewas initialized tofalse, and the modal'suseEffectreset the dataset name but did not reset the disabled state. As a result, the Duplicate button could remain enabled with an empty input.Changes
disableSavetotruedisableSaveinsideuseEffectwhenever the modal opensTesting
Executed:
npm test -- src/features/datasets/DuplicateDatasetModal.test.tsxResult: