Fundamentals: No more flickering with render before activation global default option#1345
Fundamentals: No more flickering with render before activation global default option#1345
Conversation
| this.runWithTimeRange(timeRange); | ||
| // setTimeout to let SceneVariableSet also respond to time range change | ||
| // So that variables that depend on time range have time to switch to loading state | ||
| setTimeout(() => this.runWithTimeRange(timeRange), 0); |
There was a problem hiding this comment.
This (and same in AnnotationDataLayer) is the only fix that trouble me but cannot figure out a fix without a much large system change.
The problem here is that SceneQueryRunner activates before any parent SceneVariableSet so SceneQueryRunner is first to subscribe to the time range so get's this event before SceneVariableSet so SceneVariableSet has no time to start loading a variable with refresh on time range change.
So, without this setTimeout, queries are executed twice if they depend on a variable that has "refresh on time range change".
to solve this more cleanly, we would need a new way to propagate time range changes from root to leaf (even React would struggle with this as useEffect triggers on leaves before children).
oscarkilhed
left a comment
There was a problem hiding this comment.
I've tested this with Grafana and it seems to work just fine. Left some minor suggestions that were just typos.
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
…cenes into render-panel-before-activation
Problems
Changes required when SceneObjectBase.RENDER_BEFORE_ACTIVATION_DEFAULT = true
Changes required for LazyLoader
Changes to VizPanelRendering
To try the new mode, a scene app plugin or core Grafana can enable the new behavior by executing
render_before_activation.mp4
Related OSS PR: grafana/grafana#118567
📦 Published PR as canary version:
7.1.0--canary.1345.22579240520.0✨ Test out this PR locally via:
npm install @grafana/scenes@7.1.0--canary.1345.22579240520.0 npm install @grafana/scenes-react@7.1.0--canary.1345.22579240520.0 # or yarn add @grafana/scenes@7.1.0--canary.1345.22579240520.0 yarn add @grafana/scenes-react@7.1.0--canary.1345.22579240520.0