Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone SceneQueryRunner together with _results #681

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

mdvictor
Copy link
Contributor

@mdvictor mdvictor commented Apr 5, 2024

Fixes grafana/grafana#84575

Fixes an issue where the DashboardDS would not get the correct data from the source panels SceneQueryRunner._results because the source panel _results buffer would be empty. This affected the dashboard DS in various scenarios but was observed consistently when creating a new dashboard.

In a new dashboard, if you would create a new panel, it's _results buffer in the query runner would be empty. As soon as you saved the dashboard and refreshed the page the buffer would populate and thus the DashboardDS would also work.

The problem was in SceneQueryRunner cloning where we now emit the data in the clone so it can be picked up by the DashboardDS.

📦 Published PR as canary version: 4.5.4--canary.681.8570869587.0

✨ Test out this PR locally via:

npm install @grafana/scenes@4.5.4--canary.681.8570869587.0
# or 
yarn add @grafana/scenes@4.5.4--canary.681.8570869587.0

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
@mdvictor mdvictor added patch Increment the patch version when merged release Create a release when this pr is merged labels Apr 5, 2024
Copy link
Member

@dprokop dprokop left a comment

Choose a reason for hiding this comment

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

<3

@@ -421,6 +421,8 @@ export class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> implemen
clone['_layerAnnotations'] = this._layerAnnotations.map((frame) => ({ ...frame }));
}

clone['_results'].next({ origin: this, data: this.state.data });
Copy link
Member

Choose a reason for hiding this comment

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

a unit test would be nice

@dprokop
Copy link
Member

dprokop commented Apr 5, 2024

This should also fix grafana/grafana#84573 right?

UPDATE: ah of course not, it's completely different thing :)

@mdvictor mdvictor merged commit 472fe2f into main Apr 5, 2024
3 checks passed
@mdvictor mdvictor deleted the mdvictor/load-dashboard-ds-data branch April 5, 2024 14:47
@grafanabot
Copy link
Contributor

🚀 PR was released in v4.5.4 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released
Projects
Status: 🚀 Done
Development

Successfully merging this pull request may close these issues.

Dashboard data source: Sometimes the selected panel data is not loaded
4 participants