Currently Listening and the Directory open at once, or with a spinner (#248)
Both fetched on every visit and drew only when the answer came: Currently Listening took 1.3 s. fetchPage keeps their answers by address, as the item lists are kept, sharing a request already on its way; both draw from what is kept at once and again only if the refresh changed them, and show the spinner with nothing kept. They are fetched ahead with the lists when the page loads, and when the pointer or a finger reaches their row. Removing an episode from Currently Listening forgets its kept copy, which would otherwise show it again until the refresh. The preload loop takes a failed fetch as done instead of leaving an unhandled rejection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2034,3 +2034,23 @@ test('a list seen before shows at once, and one not yet seen shows a spinner whi
|
||||
await expect(page.locator('#eps .listload')).toHaveCount(0);
|
||||
await page.unroute(/\/api\/(entries|feeds\/[^/]+\/entries)\?/);
|
||||
});
|
||||
|
||||
test('Currently Listening and the Directory show at once once seen, with a spinner the first time', async ({ page }) => {
|
||||
// #248. Both answers held back a second and a half.
|
||||
const slow = /\/api\/(directory$|entries\?filter=in_progress)/;
|
||||
await page.route(slow, async route => { await new Promise(r => setTimeout(r, 1500)); await route.continue(); });
|
||||
// What the page fetched ahead when it loaded is let finish and then forgotten, and no more is
|
||||
// fetched ahead, or the first visit would find the Directory already here, as it is meant to.
|
||||
await page.waitForFunction(() => pageFetching.size === 0 && fetching.size === 0);
|
||||
await page.evaluate(() => { window.preloadLists = () => {}; pages.clear(); });
|
||||
for (const [id, drawn] of [[':listening', '#listening .childrow, #listening .hint'], [':directory', '#directory > *:not(.listload)']]) {
|
||||
await page.locator(`.place[data-id="${id}"]`).click();
|
||||
await expect(page.locator('.listload'), `${id}: waited for, and said so`).toBeVisible();
|
||||
await expect(page.locator(drawn).first()).toBeVisible({ timeout: 10_000 });
|
||||
await page.locator('.place[data-id=":all"]').click();
|
||||
await page.locator(`.place[data-id="${id}"]`).click();
|
||||
await expect(page.locator(drawn).first(), `${id}: drawn from what was kept`).toBeVisible({ timeout: 500 });
|
||||
await expect(page.locator('.listload')).toHaveCount(0);
|
||||
}
|
||||
await page.unroute(slow);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user