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

Dashboard filter with default value sends the wrong parameters to all cards of the same questions #19494

Closed
flamber opened this issue Dec 28, 2021 · 4 comments · Fixed by #20139
Assignees
Labels
.Frontend Priority:P2 Average run of the mill bug Querying/Parameters & Variables Filter widgets, field filters, variables etc. .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. Reporting/Dashboards .Reproduced Issues reproduced in test (usually Cypress) Type:Bug Product defects

Comments

@flamber
Copy link
Contributor

flamber commented Dec 28, 2021

Describe the bug
When you have multiple of the same question on a dashboard (e.g to do period comparison), then filter connected to just one of the cards will apply to all the cards of that question. This only happens when the filters have "Default value".

P1 contender. Regression on master.

To Reproduce

  1. Add a question two times to a dashboard (e.g Products table here)
  2. Create two filters, connect filter1 to card1, and filter2 to card2 (e.g Category)
  3. The trigger: Set a "Default value" for both filters, but different for each filter (e.g. filter1 "Doohickey" and filter2 "Gadget")
    image
  4. Save dashboard - no results will be displayed.
    image
  5. Even when removing widget values will not give any results
    image
  6. Removing filter2 and saving the dashboard (still having filter1 just connected to card1, and with a default value) will clearly show that it's sending the same parameters to card2 even though it's not connected to filter1:
    image

Information about your Metabase Installation:
Tested 33ea417 from Dec. 27th

Noticed by @ukritw

@flamber flamber added Type:Bug Product defects Priority:P2 Average run of the mill bug Reporting/Dashboards Querying/Parameters & Variables Filter widgets, field filters, variables etc. .Frontend .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. labels Dec 28, 2021
@camsaul camsaul self-assigned this Jan 3, 2022
@camsaul
Copy link
Member

camsaul commented Jan 3, 2022

I'm not 100% sure whether this is backend or frontend (would need to look at the actual API requests to confirm one way or the other) but I will investigate and then update

@daltojohnso
Copy link
Contributor

Repro'd and looking at queries the FE is sending, they look correct to me. For example, this is a for a card that is the Products table, added to a dashboard twice with different Category filters and getting no rows back:

Screen Shot 2022-01-04 at 10 36 56 AM

@flamber flamber added .Regression/master Regression that is only present on master, or bug in new upcoming feature .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. and removed .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. labels Jan 5, 2022
nemanjaglumac added a commit that referenced this issue Jan 6, 2022
nemanjaglumac added a commit that referenced this issue Jan 11, 2022
…ameters to all cards of the same questions
@flamber flamber removed the .Regression/master Regression that is only present on master, or bug in new upcoming feature label Jan 24, 2022
@nemanjaglumac nemanjaglumac added the .Reproduced Issues reproduced in test (usually Cypress) label Feb 1, 2022
@camsaul
Copy link
Member

camsaul commented Feb 1, 2022

Ok the problem here is that the API endpoint is POST /api/:dashboard-id/card/:card-id/query so we actually have know way to distinguish between having the same Card on the Dashboard twice.

We need to change the endpoint to include :dashcard-id somewhere on both backend and frontend

@camsaul
Copy link
Member

camsaul commented Feb 1, 2022

Backend changes are in #20139. Fronted will have to be updated to use the new endpoints

camsaul added a commit that referenced this issue Feb 15, 2022
camsaul added a commit that referenced this issue Feb 15, 2022
…s no value and compile Field filters to `1 = 1` (#20503)

* Fix

* More logging

* Fix unbalanced parens

* Tweak logging

* Add another test

* Tweak test to use :string/=

* More logging

* Updated fix for #20493

* Enable test

* Try disabling the #19494 tests to see what happens.

* Rework #19494 test
github-actions bot pushed a commit that referenced this issue Feb 15, 2022
…s no value and compile Field filters to `1 = 1` (#20503)

* Fix

* More logging

* Fix unbalanced parens

* Tweak logging

* Add another test

* Tweak test to use :string/=

* More logging

* Updated fix for #20493

* Enable test

* Try disabling the #19494 tests to see what happens.

* Rework #19494 test
camsaul added a commit that referenced this issue Feb 16, 2022
…s no value and compile Field filters to `1 = 1` (#20503) (#20540)

* Fix

* More logging

* Fix unbalanced parens

* Tweak logging

* Add another test

* Tweak test to use :string/=

* More logging

* Updated fix for #20493

* Enable test

* Try disabling the #19494 tests to see what happens.

* Rework #19494 test

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
This was referenced Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Frontend Priority:P2 Average run of the mill bug Querying/Parameters & Variables Filter widgets, field filters, variables etc. .Regression Bugs that were previously fixed and/or bugs unintentionally shipped with new features. Reporting/Dashboards .Reproduced Issues reproduced in test (usually Cypress) Type:Bug Product defects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants