Every virtualized list with variable-height rows eventually meets the same bug: you add a ResizeObserver to each row so you can measure it, write the measured height back into your layout state, and the page starts fighting the user's scroll. GitHub's diff-surface rebuild hit exactly this, and their fix generalizes to any large list. By the end you will know how to detect the feedback loop, how to batch measurements, and how to anchor height corrections so they don't move content under the cursor.
The feedback loop, concretely
Here is the pattern. You virtualize a list, so each row needs a measured height. You attach a ResizeObserver per row and write the height into your virtualizer's state:
// The trap: measurement triggers layout, layout triggers measurement const observer = new ResizeObserver ( ( entries ) => { for ( const entry of entries ) { const row = rowsById . get ( entry . target . dataset . id ) ; if ( row ) { virtualizer . setSize ( row . id , entry . contentRect .…