PostHog / PostHog/posthog

Bug report: List-type dashboard variables missing "Set to null" option

Open
#47,202 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature/dashboards feature/taxonomic-filters team/product-analytics team/query-performance
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.

Image

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):

  1. Create a SQL insight with a list-type variable (e.g. professional_type with values "student", "professional")
  2. Use a coalesce pattern to handle null: AND (coalesce({variables.professional_type}, '') = '' OR professional_type = {variables.professional_type})
  3. Add the insight to a dashboard along with insights using other variable types (string, boolean, date)
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.