SceneVariableSet: Fix repeated panels/rows stuck loading with render before activation - #1576
SceneVariableSet: Fix repeated panels/rows stuck loading with render before activation#1576sebastiangaiser wants to merge 1 commit into
Conversation
…before activation _traverseSceneAndNotify returned early on the first inactive scene object, skipping its entire subtree. With render before activation children activate before their parents, so when a variable resolves before its ancestors are active the notification traversal (which starts at the variable set's parent) stops there and never reaches active dependents deeper in the tree, such as repeat behaviors and query runners. They bail on the initial loading check and, without the completion notification, stay stuck on a loading spinner. Changing the variable later recovers them because by then the whole tree is active. Only gate the variableUpdateCompleted call on isActive and keep traversing into children whenever the node is active or render before activation is enabled. The classic activation order is unchanged, since an inactive node only has inactive children there. Fixes grafana/grafana#128393 Signed-off-by: Sebastian Gaiser <sebastiangaiser@users.noreply.github.com>
|
|
|
Not sure why 2 |
| // Children activate before their common ancestors | ||
| varSet.activate(); | ||
| dependent.activate(); |
There was a problem hiding this comment.
Should not dependent be activated first, then? It's a child of scene
| varSet.activate(); | ||
| dependent.activate(); | ||
|
|
||
| expect(scene.isActive).toBe(false); |
There was a problem hiding this comment.
how can a scene be inactive but the scene.stata.variables be active? the main scene object activates before it's state.$variables
With render before activation should not the repeater subtree mount / render before the parent (ie before query variable starts loading) |
|
We have a bunch of gdev test dashboards for repeating rows and panels (https://github.com/grafana/grafana/blob/main/devenv/dev-dashboards/feature-templating/templating-repeating-panels.json for example), and been unable to replicate this issue. even when making the QueryVariable complete right away |
|
is the repeated row or panel inside a tab? |
_traverseSceneAndNotify returned early on the first inactive scene object, skipping its entire subtree. With render before activation children activate before their parents, so when a variable resolves before its ancestors are active the notification traversal (which starts at the variable set's parent) stops there and never reaches active dependents deeper in the tree, such as repeat behaviors and query runners. They bail on the initial loading check and, without the completion notification, stay stuck on a loading spinner. Changing the variable later recovers them because by then the whole tree is active.
Only gate the variableUpdateCompleted call on isActive and keep traversing into children whenever the node is active or render before activation is enabled. The classic activation order is unchanged, since an inactive node only has inactive children there.
Fixes grafana/grafana#128393