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(native-filters): filter indicator stale state #16831

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

villebro
Copy link
Member

SUMMARY

The recent perf improvement PR #16545 introduced a regression where some chart indicators didn't update correctly after applying filters. This was caused by all indicators sharing the same state that was used to check if the relevant data had changed. This changes the logic so that all indicators have their own set of "previous" objects to ensure that the result is recalculated when a relevant change has occurred.

When checking if this was also a problem with the legacy indicators I noticed that the logic there mostly resembles the proposed solution here, so this shouldn't be a problem there.

Fixes: #16806

AFTER

When applying new filters, all filter indicators are now updated correctly:
image

BEFORE

Previously only the first few charts' indicators were updated; the later ones always hit the cache due to the shared state having already been updated and hence satisfying the equality checks:
image

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 24, 2021

Codecov Report

Merging #16831 (6f2f0e2) into master (c933250) will decrease coverage by 0.00%.
The diff coverage is 46.15%.

❗ Current head 6f2f0e2 differs from pull request most recent head 5085e42. Consider uploading reports for the commit 5085e42 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16831      +/-   ##
==========================================
- Coverage   76.99%   76.99%   -0.01%     
==========================================
  Files        1018     1018              
  Lines       54668    54673       +5     
  Branches     7456     7456              
==========================================
- Hits        42094    42093       -1     
- Misses      12329    12335       +6     
  Partials      245      245              
Flag Coverage Δ
javascript 71.08% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/db_engine_specs/__init__.py 46.15% <0.00%> (-3.85%) ⬇️
...src/dashboard/components/FiltersBadge/selectors.ts 79.45% <100.00%> (-0.14%) ⬇️

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 c933250...5085e42. Read the comment docs.

@geido
Copy link
Member

geido commented Sep 24, 2021

/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true FEATURE_DASHBOARD_CROSS_FILTERS=true FEATURE_DASHBOARD_NATIVE_FILTERS_SET=true FEATURE_DASHBOARD_FILTERS_EXPERIMENTAL=true

@github-actions
Copy link
Contributor

@geido Ephemeral environment spinning up at http://54.214.186.247:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

The fix looks good to me for what concerns the applied filters. However, in the original issue, it seems that the query is also not updated sometimes. I tested the Video Games Sales dashboard and it appears that Charts that have temporal columns, such as the # of Games That Hit 100k in Sales By Release Year, didn't get the query updated.

As discussed, I agree that this should be filed separately as the problem seems to be affecting the Dashboard persistently and it does not look to be related to the filter indicators. CC @junlincc @jinghua-qa

@jinghua-qa
Copy link
Member

With this fix, the indicator got updated when filter applied and when filter clear, but I still saw the 2nd issue I mentioned in #16806:

when filter applied, sometimes the query did not got updated, should i file this seperately?
Screen Shot 2021-09-24 at 10 59 58 AM

@villebro
Copy link
Member Author

With this fix, the indicator got updated when filter applied and when filter clear, but I still saw the 2nd issue I mentioned in #16806:

when filter applied, sometimes the query did not got updated, should i file this seperately?
Screen Shot 2021-09-24 at 10 59 58 AM

@jinghua-qa let's file a separate issue, as they are unrelated bugs

@villebro villebro merged commit 42fa548 into apache:master Sep 27, 2021
@villebro villebro deleted the villebro/indicator-cache branch September 27, 2021 05:34
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@sadpandajoe
Copy link
Contributor

🏷️ 2021.38

stevenuray pushed a commit to preset-io/superset that referenced this pull request Sep 27, 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.38 preset-io size/S 🚢 1.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native filter] Filter indicator do not show correctly on all charts when time filter applied
5 participants