SQR: Fix datasource-template runtime routing for multi-select fan-out#1416
Merged
harisrozajac merged 6 commits intomainfrom Apr 2, 2026
Merged
SQR: Fix datasource-template runtime routing for multi-select fan-out#1416harisrozajac merged 6 commits intomainfrom
harisrozajac merged 6 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SceneQueryRunner runtime datasource resolution so panels using a templated datasource variable (e.g. ${ds}) can correctly fan out execution when the variable has multiple selected values, by routing execution through the Mixed datasource path.
Changes:
- Add runtime detection logic to decide when to use the Mixed datasource for query execution based on datasource templating and variable selection count.
- Preserve the original templated datasource ref on request targets when executing via Mixed, so Mixed can perform the fan-out.
- Extend unit tests to cover single-selection, multi-selection, and “ambiguous” templated datasource UID cases; update snapshot accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/scenes/src/querying/SceneQueryRunner.ts |
Adds Mixed-runtime routing decision logic and adjusts request target datasource assignment to preserve templated refs when running via Mixed. |
packages/scenes/src/querying/SceneQueryRunner.test.ts |
Adds unit tests verifying Mixed vs non-Mixed runtime datasource selection behavior for templated datasource variables. |
packages/scenes/src/querying/__snapshots__/SceneQueryRunner.test.ts.snap |
Updates snapshot output due to additional tests affecting requestId counter progression. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kristinademeshchik
approved these changes
Apr 2, 2026
Contributor
kristinademeshchik
left a comment
There was a problem hiding this comment.
I tested this on different combinations v1/v2 with/without panel level ds works well!
|
🚀 PR was released in |
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.
This PR fixes runtime execution for panels using a datasource variable with multiple selected values.
Previously, when a datasource variable (for example ${ds}) had multiple selected values, runtime could execute only one datasource query path (effectively the first), instead of running across all selected datasources.
This change ensures runtime routes templated datasource execution through the Mixed datasource path so all selected datasource values are executed.
The demo below shows v1 dashboards, but i've verified that this also fixes it for v2 dashboards.
Current behavior:
Screen.Recording.2026-04-02.at.9.30.06.AM.mov
With the fix:
Screen.Recording.2026-04-02.at.9.23.41.AM.mov
Fixes: grafana/grafana#121324
📦 Published PR as canary version:
7.3.8--canary.1416.23913328165.0✨ Test out this PR locally via:
npm install @grafana/scenes@7.3.8--canary.1416.23913328165.0 npm install @grafana/scenes-react@7.3.8--canary.1416.23913328165.0 # or yarn add @grafana/scenes@7.3.8--canary.1416.23913328165.0 yarn add @grafana/scenes-react@7.3.8--canary.1416.23913328165.0