grafana / scenes

Build Grafana dashboards directly in your Grafana app plugins.
https://grafana.com/developers/scenes
Apache License 2.0
133 stars 20 forks source link

SceneVariableSet: Do not propagate variable value changes when a local variable has the same name #729

Closed torkelo closed 4 months ago

torkelo commented 4 months ago

Part of row repeat fixes https://github.com/grafana/grafana/pull/87539

So we have this problem in row repeats that when the variable changes (that you repeat by). All the panel query runners inside all the repeated rows were notified that their variable dependency changed and started issuing a new queries (even when their local value did not change) .

So figured that this notification (via variableDependency) should not happen if there is a local SceneVariableSet with a local variable of the same name.

Created a test case for this scenario all is fine. This logic make sense, the variable has not changed for the local scope (as there is a local variable with the same name that has not changed).

The only really hard puzzle piece to solve is that his completely breaks the RowRepeatBehavior in core as it relies on this notification to process repeats.

So the problem here is that the first row (which we use as template / source of repeats) also get's a locally scoped value (the first variable value), so after the first repeat process this local value on the first row will block any updates the variable, which logically is correct the local value is not changing. ARHHHHfasFASDSDASFA S FQ"!° going to go for a walk.

Think the only solution is to the notification of variable changes from the behavior itself to the dashboard scene, this is now done in https://github.com/grafana/grafana/pull/87539

dprokop commented 4 months ago

Think we need to wait with merging this and coordinate with https://github.com/grafana/grafana/pull/87539 ?

torkelo commented 4 months ago

@dprokop yes, good point. Will wait merging this until that one is approved and ready to merge

grafanabot commented 4 months ago

:rocket: PR was released in v4.21.0 :rocket: