Skip to content

Fix stale cell heights after virtual row recycling - #4941

Open
tmichela wants to merge 1 commit into
tabulator-tables:masterfrom
tmichela:fix/invalidate-row-height-on-deinitialize
Open

Fix stale cell heights after virtual row recycling#4941
tmichela wants to merge 1 commit into
tabulator-tables:masterfrom
tmichela:fix/invalidate-row-height-on-deinitialize

Conversation

@tmichela

Copy link
Copy Markdown

Summary

Invalidate a row’s cached height state whenever the row is deinitialized.

This fixes incorrectly sized cells after virtual rows are recycled, which can leave column borders and cell content such as status indicators only partially rendered.

Example, initial rendering:
expected-table-render

After recycling:
broken-table-render

Problem

With horizontal and vertical virtual rendering enabled, the issue can be reproduced by:

  1. Scrolling far enough that the original rows leave the rendered window.
  2. Triggering a column resize or refit while those rows are offscreen.
  3. Jumping directly back to the original rows using the scrollbar.

When the horizontal renderer discards a row’s cells, Row.deinitialize() marks the row as uninitialized but leaves heightInitialized set to true.

When that row is rendered again, new cell elements are created. However, the stale height flag makes Tabulator treat their heights as already normalized, so the configured row height is not applied to the recreated cells. The cells can
consequently render at their natural content height, clipping or misaligning borders, pseudo-elements, and other height-dependent content.

Fix

Reset heightInitialized in Row.deinitialize().

This keeps the row lifecycle consistent: once the existing cell elements have been discarded, their cached height state is no longer valid. The next render therefore measures and normalizes the newly created cells.

Tests

Added:

  • A unit test verifying that Row.deinitialize() invalidates both initialization flags.
  • A Playwright regression that:
    • moves the original rows outside the virtual rendering window,
    • resizes a column while they are offscreen,
    • jumps directly back to the first row,
    • verifies that every recreated cell receives the configured row height.

Clear heightInitialized when row cells are discarded so virtual renderers normalize recreated cells after large scroll jumps and column refits.

Add unit and browser regressions for the stale cell-height cache.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant