Currently we only cache cell total height, which is good enough for markup previews and code cells without any output. While exploring #170881 , I found that as long as there are cell outputs, the cell total height cache is invalidated immediately on cell render. What happens is
Open notebook
Restore cell total height from cache
Render cells in viewport
Cell renders, it prepares the monaco editor and output container. The preparation triggers a layoutInfo recompute. The recompute reads the cell output height store (which is still empty) and the calculated cell output height is 0. Thus the newly calculated cell total height is smaller than the cache total height.
Cell shrinks
... Next AF ...
Output rendered and height updated, cell height grows again
Currently we only cache cell total height, which is good enough for markup previews and code cells without any output. While exploring #170881 , I found that as long as there are cell outputs, the cell total height cache is invalidated immediately on cell render. What happens is
layoutInfo
recompute. The recompute reads the cell output height store (which is still empty) and the calculated cell output height is 0. Thus the newly calculated cell total height is smaller than the cache total height.https://user-images.githubusercontent.com/876920/213004714-66a78c3d-9edd-4413-a380-e711b3050c61.mov
We could consider caching the cell output total height and only recompute the output height after output is rendered.