Skip to content
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(dnd): make clicked dnd metrics unique #16632

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

villebro
Copy link
Member

@villebro villebro commented Sep 8, 2021

SUMMARY

When creating a metric using the click handler on DnD, we currently memoize an instance of adhocMetric that becomes the reference for all future clicked adhoc metrics. This causes all adhoc metrics that have been created by clicking to be mutated whenever we edit an adhoc metric that was also created by clicking.

To avoid unnecessary rerenders that would be a consequence of simply removing useMemo, we here instead initialize the droppedItem to an empty object, which then returns a fresh adhocMetric for each click.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@codecov
Copy link

codecov bot commented Sep 8, 2021

Codecov Report

Merging #16632 (7c3cd55) into master (519baa6) will increase coverage by 0.00%.
The diff coverage is 70.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #16632   +/-   ##
=======================================
  Coverage   76.77%   76.77%           
=======================================
  Files        1003     1004    +1     
  Lines       53959    53965    +6     
  Branches     7330     7333    +3     
=======================================
+ Hits        41427    41432    +5     
- Misses      12293    12294    +1     
  Partials      239      239           
Flag Coverage Δ
javascript 71.09% <70.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ontrols/DndColumnSelectControl/DndMetricSelect.tsx 41.87% <57.14%> (+0.47%) ⬆️
...nd/src/explore/components/DatasourcePanel/types.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 519baa6...7c3cd55. Read the comment docs.

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@villebro villebro merged commit 9dfa33f into apache:master Sep 8, 2021
@villebro villebro deleted the villebro/click-dnd-metric-unique branch September 8, 2021 10:21
@villebro villebro added the v1.3 label Sep 8, 2021
stevenuray pushed a commit to preset-io/superset that referenced this pull request Sep 8, 2021
@villebro villebro removed the v1.3 label Sep 9, 2021
@stevenuray
Copy link

stevenuray commented Sep 9, 2021

🏷️ 2021.36

1 similar comment
@stevenuray
Copy link

🏷️ 2021.36

stevenuray pushed a commit to preset-io/superset that referenced this pull request Sep 10, 2021
@rosemarie-chiu
Copy link
Contributor

🏷 2021.34

@villebro villebro added v1.3 and removed v1.3 labels Sep 22, 2021
opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels preset:2021.34 preset:2021.36 preset-io size/S 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants