Bug report: List-type dashboard variables missing "Set to null" option
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Bug Description
Please describe.
On dashboards, list-type SQL variables don't have the "Set to null" toggle that other variable types (string, number, boolean, date) get. So there's no way to actually set a list variable to null from the dashboard UI.
Root cause appears to be in frontend/src/queries/nodes/DataVisualization/Components/Variables/Variables.tsx where the VariableComponent has an early return for list variables when showEditingUI is false (which it always is on dashboards via VariablesForDashboard). This renders a plain LemonSelect dropdown without the LemonSwitch null toggle that the VariableInput popover provides for every other type.
How to reproduce
(Using the reporting customer's queries for the repro examples):
- Create a SQL insight with a list-type variable (e.g.
professional_typewith values "student", "professional") - Use a coalesce pattern to handle null:
AND (coalesce({variables.professional_type}, '') = '' OR professional_type = {variables.professional_type}) - Add the insight to a dashboard along with insights using other variable types (string, boolean, date)
- On the dashboard, note that the other variables show a "Set to null" toggle but the list variable only shows its dropdown options, no way to set it to null
Additional context
From: https://posthoghelp.zendesk.com/agent/tickets/49343 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/51283)
Debug info
Debug info
Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/019c358c-95f2-7ffb-bea9-f55c5b5b44f9?t=0
Admin: http://go/adminOrgEU/018bfcb3-1770-0000-e72a-c6904e30256b (project ID 122423)
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 in frontend/src/queries/nodes/DataVisualization/Components/Variables/Variables.tsx, focusing on VariableComponent and the dashboard path through VariablesForDashboard. Compare the list-variable rendering with the VariableInput popover and verify that dashboard list variables expose the existing "Set to null" control. Done means a list variable can be set to null from the dashboard UI like the other variable types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100