perf(grid-pool): drop bufferRows 3→2 + skeleton placeholder
Two complementary changes to the chunked LocalLibrary grid:
- `bufferRows = 2` in AlbumGridPool. With ~7 cols + ~5 visible
rows, pool size drops from 77 to 63 cards (-18%). Under software
compositing each rendered card carries per-frame paint and hit-
testing cost, so trimming buffer is a direct win. Chunk pre-
fetch lead time is unchanged in practice — chunks are 100 albums
= ~14 rows, so even bufferRows=1 would give ample lead.
- `renderPlaceholder` snippet wired up in LocalLibraryView. When a
slot maps to an index whose chunk hasn't arrived, the pool now
renders a static skeleton (cover block + 3 text bars) instead
of leaving the slot blank. No shimmer, no animation — shape
alone signals "loading". Matches the loaded card dimensions
so binding the real data later doesn't shift layout.
cc
This commit is contained in:
2 files changed
+45
-2
No files matched your search
@@ -6472,12 +6472,27 @@
|
||||
onToggleSelect={() => toggleAlbumSelect(album)}
|
||||
/>
|
||||
{/snippet}
|
||||
{#snippet renderMetadataAlbumPlaceholder(_idx: number)}
|
||||
<!-- Static skeleton: 210x210 cover block + 14px
|
||||
title bar + 12px artist bar + 14px quality
|
||||
pill. No shimmer, no animation — the shape
|
||||
alone signals "loading" without paint per
|
||||
frame. Matches the loaded card dimensions
|
||||
so layout doesn't shift on rebind. -->
|
||||
<div class="album-skeleton" aria-hidden="true">
|
||||
<div class="album-skeleton-cover"></div>
|
||||
<div class="album-skeleton-line album-skeleton-title"></div>
|
||||
<div class="album-skeleton-line album-skeleton-artist"></div>
|
||||
<div class="album-skeleton-line album-skeleton-quality"></div>
|
||||
</div>
|
||||
{/snippet}
|
||||
<AlbumGridPool
|
||||
totalCount={metadataAlbumsChunked.total}
|
||||
getItem={(i) => metadataAlbumsChunked.getAlbum(i) as LocalAlbum | null}
|
||||
onNeedIndex={(i) => metadataAlbumsChunked.requestIndex(i)}
|
||||
dataVersion={metadataAlbumsChunked.version}
|
||||
renderCell={renderMetadataAlbumCell}
|
||||
renderPlaceholder={renderMetadataAlbumPlaceholder}
|
||||
/>
|
||||
{:else}
|
||||
<VirtualizedAlbumList
|
||||
@@ -7963,6 +7978,30 @@
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* Skeleton placeholder for chunked-album grid slots whose data is
|
||||
still in flight. Static blocks only — no shimmer, no animation;
|
||||
the shape signals "loading" without paint per frame. */
|
||||
.album-skeleton {
|
||||
width: 210px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.album-skeleton-cover {
|
||||
width: 210px;
|
||||
height: 210px;
|
||||
border-radius: 8px;
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
.album-skeleton-line {
|
||||
height: 12px;
|
||||
border-radius: 3px;
|
||||
background: var(--bg-tertiary);
|
||||
}
|
||||
.album-skeleton-title { width: 80%; height: 14px; margin-top: 2px; }
|
||||
.album-skeleton-artist { width: 60%; }
|
||||
.album-skeleton-quality { width: 90px; height: 14px; border-radius: 4px; margin-top: 2px; }
|
||||
|
||||
/* Album Grid */
|
||||
.album-sections {
|
||||
display: flex;
|
||||
|
||||
@@ -94,8 +94,12 @@
|
||||
const totalHeight = $derived(totalRows * rowStep + bottomPadding);
|
||||
|
||||
/** Buffer rows above + below the viewport so a fast scroll doesn't
|
||||
* paint into blank slots before the bindings update. */
|
||||
const bufferRows = 3;
|
||||
* paint into blank slots before the bindings update. Lower means
|
||||
* fewer cards mounted per frame (cheaper paint/layout) but more
|
||||
* chance the user sees a slot rebind during continuous scroll.
|
||||
* Two rows balances the two; under SW comp the per-card cost is
|
||||
* the dominant frame budget, so trimming buffer is a direct win. */
|
||||
const bufferRows = 2;
|
||||
|
||||
/** Rows that fit on screen at once (rounded up). */
|
||||
const visibleRows = $derived(
|
||||
|
||||
Reference in new issue
Block a user