livebook-dev / kino

Client-driven interactive widgets for Livebook
Apache License 2.0
362 stars 60 forks source link

Convert container contents to output lazily #393

Closed jonatanklosko closed 7 months ago

jonatanklosko commented 7 months ago

For frames Kino.Output.to_livebook/2 returns an output with the current set of outputs. Currently containers (grid/tabs/frame) convert their contents to output eagerly, and so if the content representation changes, a future container render is not going to know about it. Example:

frame_inner = Kino.Frame.new()
grid = Kino.Layout.grid([frame_inner])

Kino.Frame.render(frame_inner, "content")
grid

This PR makes the conversion lazy, so that containers store their contents as is, and only call Kino.Output.to_livebook/2 on render.