Skip to content

Add date filter controls for dashboard viewers - #32380

Merged
ehconitin merged 1 commit into
ehco/dashboard-filter-chart-queriesfrom
ehco/dashboard-filter-viewer-ui
Dec 4, 2026
Merged

ehconitin merged 1 commit into
ehco/dashboard-filter-chart-queriesfrom
ehco/dashboard-filter-viewer-ui

Conversation

@ehconitin

@ehconitin ehconitin commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

What

Viewers can change a saved dashboard date filter from the bar below the tabs. For example, changing Reporting period narrows the bar, line, and pie charts connected to that filter. A tab shows a chip when one of its visible charts uses that filter.

How

  • Reuse the object filter chip, operand menu, and date pickers.
  • Keep viewer selections in browser storage per workspace member and dashboard. Reset restores the saved defaults.
  • Send the selected date only to charts with a saved binding, behind the existing dashboard filters flag.

Stacked on #32378. Creating and connecting filters in the editor, record tables, and chart drilldown are follow-ups.

Testing

Passed 11 focused frontend tests across three suites, along with the frontend typecheck and lint. The viewer coverage checks clearing the date, switching tabs, and resetting to the saved default.

View guided diff

@twenty-ci-bot-public

Copy link
Copy Markdown

🚀 Preview Environment Ready!

Your preview environment is available at: https://toner-yang-telecommunications-cams.trycloudflare.com

This environment will automatically shut down after 5 hours.

@ehconitin
ehconitin marked this pull request as ready for review December 4, 2026 12:10
@twenty-ci-bot-public

Copy link
Copy Markdown

🤖 PR Review

Check Result
🔍 Build safety ⏭️ skipped — external-only
🧭 Triage ⏭️ skipped — external-only
📐 Quality ✅ passed — 3 nit(s)
🛡️ Security ✅ passed
🚦 Auto-approve 👀 needs review — Complexity is medium
🔐 Permissions ⏭️ skipped: no endpoint permission change

🛡️ Security Review

✅ No high-severity vulnerabilities detected.


🚦 Auto-approve

🙋 Manual review recommended for the following reason(s):

  • Complexity is medium

  • 🧠 Complexity: medium

  • 📏 Size: +696 / -48 lines across 20 file(s)


View details

Automated pre-review — human approval still required.

@twenty-ci-bot-public

Copy link
Copy Markdown

🟡 Quality review · 3 findings

Safe to merge behind IS_DASHBOARD_FILTERS_ENABLED — two non-blocking consistency issues

High-level — This frontend-only, feature-flagged change uses the server's existing filters field and chart pageFilterValues input, so rollout order is fine; but a dashboard filter changes the chart's grouping timezone and isn't carried into chart drill-downs.
Low-level — 1 rule violation found — 1196 rule questions over 25 piece(s) of 20 file(s)

💬 3 inline comments on the diff.


Reviewed against the pr-review standard — high-level then low-level. Advisory; human review still required. Run details.

return isNonEmptyArray(pageFilterValues)
? {
input: { widgetId, pageFilterValues },
configuration: { timezone: userTimezone },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit · High-level · engineering architecture

Applying a dashboard filter replaces the widget's saved configuration.timezone with the viewer's timezone

The server uses configuration.timezone for both date bucketing and resolving the page filter (bar-chart-data.service.ts:141). So when a filter is turned on, the chart's day and month buckets move into the viewer's timezone, and the same chart groups differently depending on whether a filter is set. Send the filter timezone in its own field (or take it from the user server-side) and leave the widget's grouping timezone alone.

colorMode,
objectMetadataItem,
} = useGraphBarChartWidgetData({
widgetId: widget.id,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit · High-level · product & vision

Chart click-through ignores the active dashboard filter, so the drill-down list no longer matches the filtered chart

buildChartDrilldownQueryParams (widgets/graph/utils/buildChartDrilldownQueryParams.ts) only adds configuration.filter and the clicked bucket. A bar that shows 12 records under 'Reporting period: Today' opens a record list with every date. Pass the widget's dashboard filter values into the drill-down params for bar, line and pie charts, or say in the PR that this is a deliberate follow-up.

value?.operand === filter.defaultValue?.operand &&
value?.value === filter.defaultValue?.value
) {
delete next[filter.id];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit · Low-level · No delete``

The added code uses the delete operator on next[filter.id], which the no-delete rule forbids; build the object without that key or set it through a non-delete approach instead.

@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5RetriggerView in Greptile

[Medium impact] The change affects dashboard viewers and chart queries within the dashboard filter workflow.

Fix the loss of dashboard dates after saving a layout before merging.

Findings

  1. P1 Saving removes dashboard dates ▶
  2. P2 Relative periods stay hidden ▶

Summary

Adds viewer date controls below dashboard tabs.

  • Dashboard viewers can change saved date filters from a bar.
  • Bound charts receive the viewer’s selected date filter.

Acknowledged follow-up: ehconitin explicitly deferred chart drilldown in the PR description.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Saved filter defaults] --> C[Viewer date choices]
  B[Browser overrides] --> C
  C --> D[Values grouped by bound widget]
  D --> E[Bar, line, and pie chart requests]
  F[Visible charts in active tab] --> G[Date controls]
  G --> B
  H[Reset] --> A
Loading

Reviews (1) · Last reviewed commit: "Add date filter controls for dashboard v..." · Reviewed by Greptile

Comment on lines +9 to +14
filters {
id
type
label
icon
position

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Saving removes dashboard dates

Saving a layout change on a filtered dashboard removes its date controls and stops applying their dates until the layout reloads. useSavePageLayout replaces the stored layout with the mutation response, but that response does not select filters. The new query loads them initially, while PageLayoutTabsRenderer removes the provider when they are missing.

Include filters in the save response, preserve them during replacement, or refetch the layout after saving.

Comment on lines +29 to +33
const DATE_OPERANDS: ViewFilterOperand[] = getRecordFilterOperands({
filterType: 'DATE',
})
.filter((operand) => operand !== ViewFilterOperand.IS_RELATIVE)
.map((operand) => ViewFilterOperand[operand]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Relative periods stay hidden

Saved relative dates filter charts, but viewers cannot see or edit the period correctly. The server accepts IS_RELATIVE, while DATE_OPERANDS removes it, so opening such a filter shows IS instead. DashboardDateFilter also cannot format its relative value, leaving only the label and a colon.

Support relative dates with the existing relative-date picker and display helpers so viewers can read the active period and change it.

@ehconitin
ehconitin merged commit 7085e41 into ehco/dashboard-filter-chart-queries Dec 4, 2026
33 of 35 checks passed
@ehconitin
ehconitin deleted the ehco/dashboard-filter-viewer-ui branch December 4, 2026 12:17
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor
Fails
🚫

node failed.

Log

Details
�[31mError: �[39m SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
�[90m    at parseJSONFromBytes (node:internal/deps/undici/undici:3240:19)�[39m
�[90m    at successSteps (node:internal/deps/undici/undici:7204:27)�[39m
�[90m    at readAllBytes (node:internal/deps/undici/undici:4696:13)�[39m
�[90m    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)�[39m
danger-results://tmp/danger-results-306f007a.json

Generated by 🚫 dangerJS against 7085e41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant