Skip to content

fix(dashboards): Merge URL filters with saved filters instead of replacing them#109590

Merged
DominikB2014 merged 3 commits intomasterfrom
dominikbuszowiecki/browse-364-temporary-global-filters-replace-defined-filters
Mar 4, 2026
Merged

fix(dashboards): Merge URL filters with saved filters instead of replacing them#109590
DominikB2014 merged 3 commits intomasterfrom
dominikbuszowiecki/browse-364-temporary-global-filters-replace-defined-filters

Conversation

@DominikB2014
Copy link
Contributor

When navigating to a dashboard via a linked dashboard URL (e.g. by clicking a table cell that links to another dashboard), any temporary filters in the URL were completely replacing the destination dashboard's permanent saved global filters.

The fix merges URL filters with the saved filters: for each URL filter, if a saved filter exists with the same tag.key + dataset, the URL version takes precedence. Saved filters that don't overlap with any URL filter are preserved as-is.

Before: destination dashboard permanent filters [A, B] + URL temporary filter [C][C]
After: destination dashboard permanent filters [A, B] + URL temporary filter [C][A, B, C]

If a temporary filter overlaps with a permanent one (same key/dataset), the temporary filter still wins for that key — only non-overlapping permanent filters are kept.

…acing them

When navigating to a dashboard via a linked dashboard URL, temporary
filters in the URL were completely replacing the destination dashboard's
permanent saved filters. Now URL filters are merged with saved filters:
overlapping keys are replaced by the URL version, but non-overlapping
permanent filters are preserved.

Co-Authored-By: Claude <noreply@anthropic.com>
@linear
Copy link

linear bot commented Feb 27, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 27, 2026
@DominikB2014
Copy link
Contributor Author

@cursor review

@DominikB2014 DominikB2014 marked this pull request as ready for review February 27, 2026 18:44
@DominikB2014 DominikB2014 requested a review from a team as a code owner February 27, 2026 18:44
Copy link
Contributor

@edwardgou-sentry edwardgou-sentry left a comment

Choose a reason for hiding this comment

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

Code looks fine to me, not sure if the cursor comment is true though?

When a dashboard has both saved filters and URL filters, the filter bar
merges them but never propagated the merged state to the URL. This caused
widgets to query with only raw URL filters while the filter bar displayed
the full merged set. Adding a useEffect on mount syncs the merged filters
to the URL so widgets see the same filters as the filter bar.
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

When a user clears all global filters, the URL contains an empty array.
The !urlFilters guard didn't catch this since ![] is false in JS,
causing saved filters to be incorrectly restored. Added explicit
length check to respect the user's "clear all" action.
@DominikB2014 DominikB2014 merged commit 516c963 into master Mar 4, 2026
60 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/browse-364-temporary-global-filters-replace-defined-filters branch March 4, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants