Inconsistency in category values between question embed and dashboard embed
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 49.3k
- Forks
- 6.8k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 653
Description
**Describe the bug**
If you embed a question that has a field filter as a parameter, then the filter in the embedded view will show all the categories, but if you embed that same question inside a dashboard and add a connected category, it will only show values that exist for the card (as if it was a linked filter)
**Logs**
NA
**To Reproduce**
1. enable embedding
2. create a SQL question like:
```
SELECT ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5) AS "products", sum("public"."orders"."total") AS "sum"
FROM "public"."orders"
LEFT JOIN "public"."products" ON "public"."orders"."product_id" = "products"."id"
LEFT JOIN "public"."people" ON "public"."orders"."user_id" = "people"."id"
WHERE {{category}} and {{id}}
GROUP BY ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5)
ORDER BY ((floor((("products"."price" - 12.5) / 12.5)) * 12.5) + 12.5) ASC
```
(category is a field filter to product.category and id is a field filter to [people.id]()
3) embed the card only with ID being locked and category being editable.
Pass an ID in the JWT and see that the filter will show all the values in the category, no matter the ID in the locked filter

4. Now add the question to a dashboard and add 2 filters: category and ID, link those filters and embed the dashboard with Id being locked and category editable.
Pass an ID to the dashboard and see how Metabase will show only the categories that have a row in the DB and correspond to the ID being passed (much like as a linked filter works)

NOTE: User I'm using on the JWT has ID 4, not 1 as the images tell
**Expected behavior**
We should provide a consistent experience if you embed a dashboard or a question
**Screenshots**
See in the repro
**Information about your Metabase Installation:**
* Your browser and the version: Brave latest
* Your databases: Postgres 12
* Metabase version: 1.44.4
* Metabase hosting environment: Docker
* Metabase internal database: H2
**Severity**
P3
**Additional context**
Walked by this bug while checking ticket 12527
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the question and dashboard embedding flows from the SQL example, using the locked ID passed in the JWT and an editable category filter. Compare the category values returned by each embedded view; done means question and dashboard embeds provide the same category options for the same locked filter context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure, postgresql, sql
- Domain
- analytics, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100