List View: Collapse off-window placeholder rows into a single spacer row - #80953
List View: Collapse off-window placeholder rows into a single spacer row#80953Mamaduka wants to merge 3 commits into
Conversation
|
Size Change: +26 B (0%) Total Size: 7.76 MB 📦 View Changed
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Flaky tests detected in 32f29c9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/30540580972
|
|
I've run out of time this week, but just a drive-by comment to say that this is awesome! Such a good idea to use a single spacer row instead. I was wondering a while back how web apps like iCloud photos feel so smooth when navigating tens of thousands of items and they seem to use a similar approach (in that case it's height set on the container instead of a placeholder row but the effect is much the same). It could be cool to try out an approach like this for DataViews infinite scroll too, if we know how tall things are going to be 🤔 In any case, keen to give this a review next week if it's still open! |
|
Thanks, Andrew! It looks like many popular virtualization libraries use something similar, but the List View has some specific requirements, so drop-in replacements aren't possible. Adopting some of their approaches seems like a good middle ground. |
What?
Related #80935 and #80929.
Off-window blocks in the List View each rendered their own
<tr><td class="…placeholder">. This coalesces consecutive off-window blocks into a single spacer row sized to the run (count × 32px).Why?
On a 1000-block post, the placeholders were 962 rows / ~1900 elements — ~60% of the List View's DOM and ~48% of the whole document. Every style recalculated in the open frame, so they dominated the cost of opening the List View.
How?
ListViewBranchaccumulates off-window blocks and flushes them as one row, before any real row and before a nested branch (children of an off-window parent can still be in view). Spacer height is set inline, soBLOCK_LIST_ITEM_HEIGHTmoved fromindex.jstoutils.js(both already import from it — no cycle). Also drops a stale comment claiming rows are 36px; they are 32px.No change to the windowing math,
windowOverscan, or treegrid semantics: spacers carry norole, TreeGrid navigates[role="row"], the drop zone uses[data-block], and the first/last/selected/dragged rows still always render.Testing Instructions
blocks × 32px).Testing Instructions for Keyboard
Same.
Screenshots or screencast
Use of AI Tools
Assisted by Claude.