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(explore): clean data when hidding control #19039

Merged
merged 17 commits into from
Apr 6, 2022

Conversation

stephenLYZ
Copy link
Member

@stephenLYZ stephenLYZ commented Mar 6, 2022

SUMMARY

This PR solves the problem that form data will not be cleared when hiding a control via dynamic controls (e.g. orderBy). These are what I did:

  • Make a control whose visibility is false doesn't return null in parent component rendering, but returns null in child component and resets the control value in child component useEffect.
  • Since it still renders in component trees and we need to make it behave the same as HiddenControl (don't be counted and don't display)
  • Clean unused code
  • Add more tests for this part

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before

before.mov

after

after.mov

TESTING INSTRUCTIONS

  • Create a Timeseries chart
  • Add one METRIC
  • Add one SORT BY
  • Uncheck SORT DESCENDING
  • Run query
  • Remove SORT BY
  • Run query
  • view the query

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 Mar 6, 2022

Codecov Report

Merging #19039 (a3e1ed2) into master (a59718b) will increase coverage by 0.00%.
The diff coverage is 75.00%.

❗ Current head a3e1ed2 differs from pull request most recent head 8c0ad91. Consider uploading reports for the commit 8c0ad91 to get more accurate results

@@           Coverage Diff           @@
##           master   #19039   +/-   ##
=======================================
  Coverage   66.59%   66.59%           
=======================================
  Files        1682     1682           
  Lines       64291    64299    +8     
  Branches     6554     6558    +4     
=======================================
+ Hits        42815    42823    +8     
+ Misses      19775    19774    -1     
- Partials     1701     1702    +1     
Flag Coverage Δ
javascript 51.37% <75.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
...et-ui-chart-controls/src/shared-controls/index.tsx 36.19% <ø> (ø)
...perset-frontend/src/explore/components/Control.tsx 70.00% <50.00%> (+16.15%) ⬆️
.../src/explore/components/ControlPanelsContainer.tsx 79.59% <100.00%> (-0.21%) ⬇️
...set-frontend/src/explore/components/ControlRow.tsx 100.00% <100.00%> (ø)
superset-frontend/src/profile/App.tsx 0.00% <0.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 a59718b...8c0ad91. Read the comment docs.

@stephenLYZ stephenLYZ closed this Mar 7, 2022
@stephenLYZ stephenLYZ reopened this Mar 7, 2022
@rusackas rusackas requested a review from kgabryje March 18, 2022 05:28
@pull-request-size pull-request-size bot added size/L and removed size/S labels Mar 18, 2022

const NUM_COLUMNS = 12;

type Control = React.ReactElement | null;

export default function ControlRow({ controls }: { controls: Control[] }) {
// ColorMapControl renders null and should not be counted
Copy link
Member Author

Choose a reason for hiding this comment

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

Currently we don't have ColorMapControl, so clean it here.

@zhaoyongjie
Copy link
Member

Hi @stephenLYZ , I tested this PR in my local, but the order direction checkbox is gone when I put an ad-hoc metric.

order.direction.gone.mov

@stephenLYZ
Copy link
Member Author

Hi @stephenLYZ , I tested this PR in my local, but the order direction checkbox is gone when I put an ad-hoc metric.

order.direction.gone.mov

Fixed.

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

LGTM!

@zhaoyongjie zhaoyongjie merged commit 0e29871 into apache:master Apr 6, 2022
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 and removed 🚢 2.0.1 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 size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants