fix: delayed metrics spec load not retaining expression filters - #9974
AdityaHegde wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical dashboard URL synchronization and additional readiness, pending-state, and cleanup issues remain.
Review effort: Lite
Findings: 1
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.
| metricsExplorerStore.mergePartialExplorerEntity( | ||
| this.exploreName, | ||
| partialExplore, | ||
| this.expressionFilterManager, | ||
| ); |
There was a problem hiding this comment.
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.
| this.metricsViewNames = metricsViewNames; | ||
| this.pendingSpecs = new Set(metricsViewNames); |
There was a problem hiding this comment.
Fixed along with replaying existing params so that changes to spec reflect in filter pills.


Recent filter manager unification didnt handle delayed filters load. It only addressed one known case of canvas in reports directly.
UrlParamsChangeTrackerthat handles waiting for spec. AllsetUrlParamsgoes through this that handles pending stores.syncStoreWithSourceand moved url synching toUrlParamsChangeTracker.syncToUrl.Moved code from WIP PR: #9833
Checklist: