Community browser: auto-fill viewport on initial render

Symptom: after opening the browser, users had to scroll down a few
pixels to see the rest of the initial card chunk. Cause: loadFeedTab's
rerender() draws the first chunk (24 cards) via diffWallCards but
skips the scroll-triggered auto-fill chain. appendFeedRows DOES
have that chain (chained-RAF that keeps adding chunks until the
modal scroller becomes scrollable), but it only runs when the user
scrolls.

Fix: after the initial diffWallCards, schedule a RAF that runs the
same viewport-fullness check appendFeedRows uses — if the modal
isn't yet scrollable AND there are unrendered rows, call
appendFeedRows. The recursive RAF inside appendFeedRows then keeps
adding chunks until the viewport is full or rows are exhausted.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.7 committed 2026-05-27 19:23:28 -04:00
1 parent fc8a89d2fa
commit e8c3115236
1 file changed
+13
+13
View File
@@ -18612,6 +18612,19 @@
initInfiniteScroll(tab);
const visibleRows = rows.slice(0, _feedPagination[tab].rendered);
diffWallCards(wallEl, visibleRows, buildFeedCardForRow);
// Auto-fill the viewport on the initial render. appendFeedRows has
// a chained-RAF auto-fill for scroll-triggered loads but the
// initial render skipped it, so if the first chunk (24 cards)
// didn't reach the bottom of a tall modal, users had to nudge
// scroll to see the next chunk. Now we trigger the same fill
// chain once the new cards have laid out.
requestAnimationFrame(() => {
const scroller = wallEl.closest('.modalCard');
if (!scroller) return;
if (_feedPagination[tab].rendered >= rows.length) return;
if (scroller.scrollHeight > scroller.clientHeight + 40) return;
appendFeedRows(tab);
});
};
_currentFeedRerender = rerender;