fix(plugin-dashboard): apply widget filter as dataset runtimeFilter (ADR-0021)#1612
Merged
Conversation
…ADR-0021)
A dataset-bound dashboard widget (dual-form) dropped its presentation-scope
`filter` when querying the dataset, so a filtered widget (e.g. "Open Pipeline",
`stage NOT IN (closed_won, closed_lost)`) rendered the UNFILTERED grand total —
the dataset query ran `SELECT SUM(amount) FROM opportunity` with no WHERE.
DatasetWidget now forwards `widget.filter` as the dataset `runtimeFilter`,
resolving date macros client-side first (exactly as the legacy object-aggregate
widgets do — the server does not expand `{current_quarter_start}` etc.). The
server already honours `runtimeFilter`; only the renderer was omitting it.
+ tests: a filtered widget sends runtimeFilter; date macros are resolved.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
A dual-form widget's legacy `compareTo: 'previousPeriod'` (a bare string) was
forwarded verbatim into the dataset query, where the executor throws
"compareTo requires a timeDimension 'undefined' with a dateRange" — surfacing
a 500 error card instead of the metric. Dataset `compareTo` must be the
structured `{ kind, dimension }` shape; only forward that, and drop the legacy
string (the base measure still renders; the comparison overlay is opt-in).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (found via browser testing)
A dataset-bound dashboard widget (ADR-0021 dual-form) dropped its presentation-scope
filterwhen querying the dataset. A filtered KPI like "Open Pipeline" (stage NOT IN (closed_won, closed_lost)) rendered the unfiltered grand total — the console issued:The server-side dataset query honours
runtimeFilter(verified: 8,179,769 filtered vs 10,653,369 total); onlyDatasetWidgetwas omitting it from the selection.Fix
DatasetWidgetnow forwardswidget.filteras the datasetruntimeFilter, resolving date macros client-side first — exactly as the legacy object-aggregate widgets do (the server does not expand{current_quarter_start}etc.). The raw filter is used for the effect signature so the render-timenowcan't cause a refetch loop.Tests
runtimeFilterruntimeFilteromitted when there's no filterDatasetWidget.test.tsx: 8/8 pass.Notes
report.filterapplied), so dataset-bound reports already render correctly.globalFilters/dateRangeare a separate, pre-existing gap (not wired for any widget) — out of scope here.🤖 Generated with Claude Code