From 94b5a7cf832f7da07c18e9eee10f845799b9b657 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 1 Oct 2026 22:38:55 -0700 Subject: New posts go in above the first post at the top of the feed Arrivals used to wait behind the pill whenever the feed header was on screen. They now go in above the first post with that post held where it is, so the page grows upward and can be scrolled to before tapping the pill. While the composer or another header field is in use they still wait. The pill clears only when the reader scrolls up to the newest post, not on the hold's own downward correction. Co-Authored-By: Claude Opus 5.5 --- tools/feed-streaming-test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tools/feed-streaming-test.js') diff --git a/tools/feed-streaming-test.js b/tools/feed-streaming-test.js index 4295243..e662b42 100644 --- a/tools/feed-streaming-test.js +++ b/tools/feed-streaming-test.js @@ -136,13 +136,15 @@ try { await page.close(); page = await visit(); - const headerTop = await page.$eval('.chat-page > .row', (r) => r.getBoundingClientRect().top); + const firstKey = await page.$eval('.notes-feed > .row[data-key]', (r) => r.getAttribute('data-key')); + const firstTop = await page.$eval(row(firstKey), (r) => r.getBoundingClientRect().top); await page.evaluate((evs) => window.deliver(evs), [fast, later]); await page.waitForFunction(() => document.querySelector('.feed-new-pill .n')?.textContent === '2', { timeout: 2000 }); - assert(!(await page.$(row(fast.id))), 'header-visible prepends wait for an explicit tap'); - assert.equal(await page.$eval('.chat-page > .row', (r) => r.getBoundingClientRect().top), headerTop); - await page.evaluate(() => { scrollTo(0, 1); scrollTo(0, 0); }); - assert.equal(await count(page), 2, 'scrolling at the top does not clear deferred new posts'); + await page.waitForSelector(row(fast.id), { timeout: 2000 }); + // header showing: they go in above the first post, which doesn't move + assert(Math.abs(await page.$eval(row(firstKey), (r) => r.getBoundingClientRect().top) - firstTop) <= 1, 'header-visible prepends hold the first post still'); + assert(await page.evaluate(() => scrollY > 0), 'the page is scrolled by what went in above'); + assert.equal(await count(page), 2, 'the pill still says how many are up there'); await page.click('.feed-new-pill'); await page.waitForSelector(row(later.id)); assert(await page.$eval(row(later.id), (r) => Math.abs(r.getBoundingClientRect().top - 8) <= 2), 'tap reveals the oldest ready new post'); -- cgit v1.2.3