Skip to content

fix: delayed metrics spec load not retaining expression filters - #9974

Open
AdityaHegde wants to merge 4 commits into
mainfrom
fix/delayed-expression-filter-load
Open

AdityaHegde wants to merge 4 commits into
mainfrom
fix/delayed-expression-filter-load

Conversation

@AdityaHegde

@AdityaHegde AdityaHegde commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Recent filter manager unification didnt handle delayed filters load. It only addressed one known case of canvas in reports directly.

  1. Adds UrlParamsChangeTracker that handles waiting for spec. All setUrlParams goes through this that handles pending stores.
  2. Removed syncStoreWithSource and moved url synching to UrlParamsChangeTracker.syncToUrl.

Moved code from WIP PR: #9833

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@AdityaHegde
AdityaHegde marked this pull request as ready for review September 30, 2026 13:01
@AdityaHegde AdityaHegde added Type:Bug Something isn't working Team:Applications Applications Working Group labels Sep 30, 2026
@nishantmonu51
nishantmonu51 requested a lite review from Copilot October 1, 2026 09:57

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical dashboard URL synchronization and additional readiness, pending-state, and cleanup issues remain.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

This PR centralizes deferred URL filter synchronization so expression filters survive delayed metrics-view spec loading.

Changes:

  • Adds readiness-aware URL parameter tracking and replay.
  • Updates dashboard, canvas, alert, report, bookmark, and public URL integrations.
  • Refactors filter-manager events, readiness, and synchronization.
File Changes
web-common/​src/​lib/​url-utils.ts Adds URL parameter subset copying.
web-common/​src/​lib/​store-utils/​url-params-store-sync.svelte.ts Implements deferred URL synchronization.
web-common/​src/​features/​scheduled-reports/​FiltersForm.svelte Removes legacy synchronization.
web-common/​src/​features/​metrics-views/​providers/​MetricsViewsProvider.svelte.ts Tracks metrics-view readiness.
web-common/​src/​features/​dashboards/​url-state/​test/​url-state-test-utils.ts Updates URL-state test helpers.
web-common/​src/​features/​dashboards/​stores/​dashboard-stores.ts Makes filter-manager merging optional.
web-common/​src/​features/​dashboards/​state-managers/​state-managers.ts Synchronizes internal filter changes.
web-common/​src/​features/​dashboards/​state-managers/​loaders/​DashboardStateSync.ts Routes dashboard URL updates through tracking.
web-common/​src/​features/​dashboards/​filters/​test/​StandaloneExpressionFiltersTest.svelte Updates standalone filter setup.
web-common/​src/​features/​dashboards/​filters/​measure-filters/​MeasureFilterManager.svelte.ts Simplifies filter clearing.
web-common/​src/​features/​dashboards/​filters/​JoinerFilterManager.svelte.ts Removes empty filter managers.
web-common/​src/​features/​dashboards/​filters/​Filters.svelte Removes legacy synchronization.
web-common/​src/​features/​dashboards/​filters/​filter-events.ts Updates filter events.
web-common/​src/​features/​dashboards/​filters/​ExpressionFilterManager.svelte.ts Integrates tracking and readiness lifecycle.
web-common/​src/​features/​dashboards/​filters/​ExpressionFilterManager.spec.ts Updates filter-manager tests.
web-common/​src/​features/​dashboards/​filters/​dimension-filters/​DimensionFilterManager.svelte.ts Simplifies filter clearing.
web-common/​src/​features/​canvas/​stores/​canvas-entity.ts Synchronizes canvas filters with URLs.
web-common/​src/​features/​canvas/​inspector/​filters/​DimensionFiltersInput.svelte Tracks local filter changes.
web-common/​src/​features/​canvas/​CanvasFilterParamsSync.svelte Replays canvas URL parameters.
web-common/​src/​features/​canvas/​CanvasDashboardWrapper.svelte Removes duplicate synchronization.
web-common/​src/​features/​alerts/​create-alert-utils.ts Applies URL filters through the tracker.
web-admin/​tests/​embeds.spec.ts Updates embed URL expectations.
web-admin/​src/​features/​public-urls/​CreatePublicURLForm.svelte Initializes filters from URL state.
web-admin/​src/​features/​bookmarks/​BookmarksFormDialog.svelte Initializes bookmark filters from URL state.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 312 to 315
metricsExplorerStore.mergePartialExplorerEntity(
this.exploreName,
partialExplore,
this.expressionFilterManager,
);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a bit tricky to handle since merging happens on explore state rather than url params. So we need to merge into partialExplore, convert to redirectUrl and then apply that to expressionFilterManager. To fix this, explore needs a greater refactor to merge based on url params instead.

Maybe one thing that we can do is when singleParamFormMv is true we can drop all other params in ExpressionFilterManager.

Comment on lines 181 to +182
this.metricsViewNames = metricsViewNames;
this.pendingSpecs = new Set(metricsViewNames);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed along with replaying existing params so that changes to spec reflect in filter pills.

This branch has not been deployed

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

Labels

Team:Applications Applications Working Group Type:Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants