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

SceneQueryRunner: Detect new variable values when cloned #727

Merged
merged 3 commits into from
May 10, 2024

Conversation

torkelo
Copy link
Member

@torkelo torkelo commented May 9, 2024

Part of row repeat fixes grafana/grafana#87539

When changing so that we repeat the first row we are cloning scene query runners that have data and putting them into a new "variable context", but the scene query runners did not detect that variables are different so did not issue new queries.

This changes clone logic of SceneQueryRunner so that it will record the current variable values (Before this only happened on deactivate)

📦 Published PR as canary version: 4.18.0--canary.727.9027841193.0

✨ Test out this PR locally via:

npm install @grafana/scenes@4.18.0--canary.727.9027841193.0
# or 
yarn add @grafana/scenes@4.18.0--canary.727.9027841193.0

@torkelo torkelo added minor Increment the minor version when merged release Create a release when this pr is merged labels May 9, 2024
tsconfig.json Outdated
Comment on lines 7 to 18
"rootDirs": [
"."
]
"rootDirs": ["."]
},
"exclude": [
"dist/**/*"
],
"include": [
"utils/**/*.ts*",
"src/**/*.ts*"
],
"exclude": ["dist/**/*"],
"include": ["utils/**/*.ts*", "src/**/*.ts*"],
"ts-node": {
"compilerOptions": {
"isolatedModules": false,
"module": "commonjs"
}
}
} No newline at end of file
}
Copy link
Member Author

Choose a reason for hiding this comment

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

this is just a vs code format, we need to update this file, we do not run typescript strict mode , but will do in separate PR

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.

Looks good

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

clone['_variableValueRecorder'] = this._variableValueRecorder.cloneAndRecordCurrentValuesForSceneObject(this);
clone['_containerWidth'] = this._containerWidth;
Copy link
Member

Choose a reason for hiding this comment

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

good catch with the missing container width 👍

@torkelo torkelo merged commit 4a2cdd3 into main May 10, 2024
3 checks passed
@torkelo torkelo deleted the scene-query-runner-detect-new-values branch May 10, 2024 09:09
@grafanabot
Copy link
Contributor

🚀 PR was released in v4.18.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor 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.

None yet

3 participants