Show date range filter in view mode for SQL insights using {filters.dateRange}
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Feature request
Is your feature request related to a problem?
SQL insights that use {filters.dateRange.from} / {filters.dateRange.to} in their query don't show the date range picker when viewing the insight. The picker only appears in edit mode. This is inconsistent with how other parts of PostHog handle this:
- Other insight types (trends, funnels, etc.) show the date filter in view mode via
InsightDisplayConfig - Insight variables (e.g., Date-type variables) are shown in view mode for SQL insights via
VariablesForInsight(rendered outside thereadOnlyguard atDataVisualization.tsxline 322)
This means users have to click "Edit" every time they want to change the date range on a SQL insight, even though the query is explicitly designed to support it.
Describe the solution you'd like
The DateRange picker in DataVisualizationNode insights should be visible in view mode, not just edit mode. Currently it's gated behind !readOnly && showResultControls in DataVisualization.tsx (line 263). The DateRange component should be moved outside the !readOnly guard, matching the pattern already used by VariablesForInsight in the same file and by the DataTable component.
Describe alternatives you've considered
Users can work around this by using Date-type insight variables ({variables.my_date_from}) instead of {filters.dateRange.from}. Variables are rendered in both view and edit modes. However, this requires users to restructure their queries and manage two separate date variables instead of using the built-in date range filter.
Additional context
Debug info
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 DataVisualization.tsx around line 263 and inspect how DataVisualizationNode insights use DateRange, showResultControls, and readOnly. Compare the existing VariablesForInsight and DataTable rendering paths. Done means the date range picker is available when viewing SQL insights using filters.dateRange while edit-mode behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- analytics, frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100