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

Wrap __sceneObject scoped var in an serialisable wrapper #828

Closed dprokop closed 2 months ago

dprokop commented 2 months ago

Alt to https://github.com/grafana/scenes/pull/824

This is a simpler approach that wraps scopedVars.__sceneObject in a serializable wrapper. This seems to be working just fine, can be tested against https://github.com/grafana/grafana/pull/90272

📦 Published PR as canary version: 5.5.0--canary.828.9973016839.0
:sparkles: Test out this PR locally via: ```bash npm install @grafana/scenes-react@5.5.0--canary.828.9973016839.0 npm install @grafana/scenes@5.5.0--canary.828.9973016839.0 # or yarn add @grafana/scenes-react@5.5.0--canary.828.9973016839.0 yarn add @grafana/scenes@5.5.0--canary.828.9973016839.0 ```
grafanabot commented 2 months ago

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

gtk-grafana commented 2 months ago

@dprokop This PR breaks Explore logs.

SceneQueryRunner.ts:467 PanelQueryRunner Error TypeError: Cannot read properties of undefined (reading '$variables')
    at lookupVariable (lookupVariable.js:2:1)
    at lookupFormatVariable (sceneInterpolator.js:38:34)
    at sceneInterpolator.js:17:1
    at String.replace (<anonymous>)
    at sceneInterpolator (sceneInterpolator.js:14:1)
    at Object.interpolate (sceneGraph.js:30:27)
    at TemplateSrv.replace (template_srv.ts:252:25)
    at DatasourceSrv.get (datasource_srv.ts:134:34)
    at eval (getDataSource.ts:21:35)
    at Generator.next (<anonymous>)
gtk-grafana commented 2 months ago

Looks like the error is thrown against grafana 11.1, but seems to work fine with latest main