grafana / scenes

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

MultiValueVariabe: Change when value changed event is published #896

Closed mdvictor closed 2 months ago

mdvictor commented 2 months ago

This PR changes then the SceneVariableValueChangedEvent is published. It should only publish, in the case of All value, only when options actually change.

This will help us in various scenarios that are currently giving us headaches like here where the variable potentially hasChanged, after a dashboard refresh, for example, but in truth there is no change in the options, and that var is set only because it sees the All value selected.

Another example is in the case of variables that depend on themselves, case that is supported in the new arch due to backwards compat with the old arch. If the value is All then the variable is constantly considered as changed and thus publishes the event which will trigger an infinite query in the variable.

In both scenarios above the issues happen only with the All value.

📦 Published PR as canary version: 5.14.4--canary.896.10848324548.0
:sparkles: Test out this PR locally via: ```bash npm install @grafana/scenes-react@5.14.4--canary.896.10848324548.0 npm install @grafana/scenes@5.14.4--canary.896.10848324548.0 # or yarn add @grafana/scenes-react@5.14.4--canary.896.10848324548.0 yarn add @grafana/scenes@5.14.4--canary.896.10848324548.0 ```
scenes-repo-bot-access-token[bot] commented 2 months ago

:rocket: PR was released in v5.14.6 :rocket: