-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Don't rerun dashcard queries when switching tabs without parameter changes #40783
Conversation
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.
There was another flaky test, which was checking exactly if the request is fired or not on tab change, but I can't find it. maybe it needs to be removed/adjusted after this one
cy.wait("@dashcardQuery"); | ||
cy.get("@dashcardQuery.all").should("have.length", 3); | ||
|
||
// Rerun 2nd tab query with new parameters |
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.
nit: instead of comments, use cy.log
// Rerun 1st tab query with new parameters | ||
setDateFilter(); | ||
cy.wait("@dashcardQuery"); | ||
cy.get("@dashcardQuery.all").should("have.length", 3); |
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.
nit: I found that way of testing number of requests as very unreliable (number can vary from run to run), but I hope it works in your case
|
1f1bb41
to
ee9decb
Compare
@metabase-bot backport release-x.48.x |
@kulyk Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
…anges (#40783) * Add E2E test * Move `getDatasetQueryParams` to `data-fetching.js` * Use `null` as a parameter value when missing * Fix missing default `datasetQuery`
…anges (#40783) * Add E2E test * Move `getDatasetQueryParams` to `data-fetching.js` * Use `null` as a parameter value when missing * Fix missing default `datasetQuery`
…t parameter changes" (#40824) * Don't rerun dashcard queries when switching tabs without parameter changes (#40783) * Add E2E test * Move `getDatasetQueryParams` to `data-fetching.js` * Use `null` as a parameter value when missing * Fix missing default `datasetQuery` * Fix E2E test --------- Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
Addresses #39863
There are a few places in the
fetchCardData
dashboard action where we're checking if queries or parameters have changed since the last run (here is an example) to decide if we need to refresh data. For versions 49 and lower, there's an unhandled case with parameters without a value. They don't have avalue
property in the last run object, but they havevalue: null
in the other object we're using for comparison. We triggerfetchCardData
when switching the dashboard tab, and this comparison logic should prevent us from redundant reruns when neither queries or parameters change, but this wasn't working as expected.On
master
this was fixed by #35465, the BE started to returnvalue: null
in query responses. This PR adds an E2E test to ensure the problem won't come back and adds a FE safety net (to be backported to 48 and 49)To reproduce