Skip to content

SceneVariableSet: Fix repeated panels/rows stuck loading with render before activation - #1576

Open
sebastiangaiser wants to merge 1 commit into
grafana:mainfrom
sebastiangaiser:fix/repeated-panel-spinner
Open

SceneVariableSet: Fix repeated panels/rows stuck loading with render before activation#1576
sebastiangaiser wants to merge 1 commit into
grafana:mainfrom
sebastiangaiser:fix/repeated-panel-spinner

Conversation

@sebastiangaiser

Copy link
Copy Markdown

_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

…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>
@sebastiangaiser
sebastiangaiser requested a review from a team as a code owner July 14, 2026 13:29
@sebastiangaiser
sebastiangaiser requested review from Sergej-Vlasov and mdvictor and removed request for a team July 14, 2026 13:29
@cla-assistant

cla-assistant Bot commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented Jul 14, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sebastiangaiser

Copy link
Copy Markdown
Author

Not sure why 2 cla-assistant are posting here but it's signed.

Comment on lines +269 to +271
// Children activate before their common ancestors
varSet.activate();
dependent.activate();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should not dependent be activated first, then? It's a child of scene

varSet.activate();
dependent.activate();

expect(scene.isActive).toBe(false);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how can a scene be inactive but the scene.stata.variables be active? the main scene object activates before it's state.$variables

@torkelo

torkelo commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

When the Query variable finishes resolving before the repeater subtree is fully activated/mounted (the race),

With render before activation should not the repeater subtree mount / render before the parent (ie before query variable starts loading)

@torkelo

torkelo commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

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

@torkelo

torkelo commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

is the repeated row or panel inside a tab?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboards: Repeated panels/rows intermittently stuck on an infinite loading spinner since 13.1.0 (scenes v8 render before activation)

2 participants