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

SceneGridLayout: Fix issue with grid taking 0 height #693

Closed ivanortegaalba closed 5 months ago

ivanortegaalba commented 7 months ago

Problem Autosizer forces the consumer to have a parent with height or with flex layout.

This was causing the issue of having grid with height 0.

Approach We can avoid that by not giving control to Autosizer and leaving the height to be the content.

We need the height from Autosizer to know the space available to fill all panels for the autofit feature. However, we don't need to let the component manage it, so we can use useMeasure to get the height.

This approach can be improved to do the measurement only if the autofit is enabled.

TODO It gets into an infinite loop. In case someone have time to take a look, feel free to take it