kgabryje opened a new pull request #16020:
URL: https://github.com/apache/superset/pull/16020


   ### 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 https://github.com/apache/superset/issues/16009
   
   After:
   
https://user-images.githubusercontent.com/15073128/127839347-f0e4e9af-c10c-4e8c-a426-03987e8180d7.mov
   
   ### TESTING INSTRUCTIONS
   0. Enable drag and drop
   1. Create a chart which has multiple controls of the same type, for example 
table or pivot table
   2. Add values to controls of the same type (e.g Metric and Percentage Metric 
in Table, or Columns and Rows in Pivot Table)
   3. Try to drag a value from 1 control to the other.
   4. Verify that nothing happened and no "undefined" error is shown
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] Has associated issue: closes #16009, closes #16007 
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   CC: @jinghua-qa @junlincc 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to