Skip to content

Commit e8d01cc

Browse files
fix(mobile): seed the v2 home recycler with a measured-average row height
Both device passes hit the LegendList dev warning ("no unused container available, creating one on demand") while scrolling the expanded snoozed/settled shelves: iOS debugInfo 9 pooled / stillNeeded 3, Android 11 / stillNeeded 1. Reading the pool math (LegendList 3.3.5): the initial container count is ceil((scrollLength + 2 * INITIAL_DRAW_DISTANCE=50) / estimatedItemSize), so on a phone the 92pt estimate seeded only 9-10 containers — fewer than the ~11-12 items a shelf-expand puts in view at once, so the re-layout overran the pool and created containers on demand (one warned pass behind the measured-height expansion that follows). Measured row heights: settled slim ~60dp, single-line cards ~74dp (252px at Pixel 10 Pro density), two-line cards ~94dp. Seeding with 72 (the average of the mix that actually sits under the finger, and the constant the v1 list on this screen already uses) makes the initial pool ceil(800/72) = 12, which covers the expand demand, removing the warning class for the short/expanded-list regime where the pool tracks the item count; LegendList self-corrects to measured spans afterwards, and long lists pool 3x the estimate-based container count regardless. The prior "taller bias is safe" note was wrong: the bias was exactly what under-sized the pool.
1 parent e0c3a3f commit e8d01cc

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎apps/mobile/src/features/home/HomeScreen.tsx‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,20 @@ interface HomeScreenProps {
139139
/* ─── Layout constants ───────────────────────────────────────────────── */
140140

141141
const ESTIMATED_THREAD_ROW_HEIGHT = 72;
142-
// v2 cards run taller than v1's compact rows (title can take two lines plus
143-
// the branch/PR footer); settled slim rows run shorter. The estimate only
144-
// sizes the recycler's initial container pool, so the taller bias is safe.
145-
const ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT = 92;
142+
// v2 rows are mixed-height: settled slim rows run ~60dp, single-line cards
143+
// measured ~74dp on device (252px on the Pixel 10 Pro screenshot), two-line
144+
// cards ~94dp. The estimate seeds the recycler's container count:
145+
// `ceil(contentSpan / estimate)`, which LegendList clamps to the content span
146+
// while the list is shorter than viewport + 2x drawDistance. An estimate at
147+
// or below the average row height keeps that count above the item count, so
148+
// a shelf-expand re-layout (which transiently demands slightly more
149+
// containers than there are items) finds one pooled instead of logging the
150+
// dev-mode "no unused container available" warning and creating one on
151+
// demand. An estimate tuned to the tallest card (~92) fires that warning on
152+
// every short/expanded list, so the average wins; oversized cards self-correct
153+
// through LegendList's measured spans, and long lists pool 3x the estimated
154+
// container count regardless.
155+
const ESTIMATED_THREAD_LIST_V2_ROW_HEIGHT = 72;
146156
const PRE_LIQUID_GLASS_BOTTOM_TOOLBAR_HEIGHT = 44;
147157
/**
148158
* Top spacing between the list and the Android custom header. The Android

0 commit comments

Comments
 (0)