-
Notifications
You must be signed in to change notification settings - Fork 13.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(explore): fix undefined error when using dnd #16020
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16020 +/- ##
==========================================
- Coverage 77.03% 76.94% -0.10%
==========================================
Files 989 990 +1
Lines 52413 52491 +78
Branches 6634 6642 +8
==========================================
+ Hits 40378 40389 +11
- Misses 11812 11878 +66
- Partials 223 224 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix! For future PRs it might be better to separate into two separate PRs; one with just the fix and another with the perf improvements (easier for the lazy reviewers like myself :D)
/testenv up ENABLE_EXPLORE_DRAG_AND_DROP=true |
@junlincc Ephemeral environment spinning up at http://34.222.129.96:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
When user tried to drag and drop value from a control to a different control of the same type, an undefined error occurred. The root of the issue was in reordering logic - in order the rearrange values, control's dnd handler had to accept a given drag item type. However if there were more controls of the same type in control panel, user could drag them to the other control, which wasn't handled in any way. This PR fixes the issue by changing control's dnd type from a generic one (like "Column", "Metric" etc.) to a more specific one (old type concatenated with control's name and label to ensure uniqueness).
In the future, we'll enhance the DnD experience by allowing user to drag and drop items across different controls (instead of prohibiting it). However, that will require deeper, riskier changes, so for now let's just fix the "undefined" error with this PR.
While I was at it, I introduced a few simple performance improvements - mostly wrapping stuff in useCallbacks and useMemos.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: see #16009
After:
https://user-images.githubusercontent.com/15073128/127839347-f0e4e9af-c10c-4e8c-a426-03987e8180d7.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
CC: @jinghua-qa @junlincc