From cdca3fa061c856f9063aadfabf1c1e713f512123 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 24 Sep 2026 08:16:17 -0700 Subject: Paint cached thread counts and header hat on refresh --- tools/thread-reply-test.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tools/thread-reply-test.js') diff --git a/tools/thread-reply-test.js b/tools/thread-reply-test.js index 39f2894..3dba87f 100644 --- a/tools/thread-reply-test.js +++ b/tools/thread-reply-test.js @@ -28,7 +28,7 @@ window.test = { ui, reply, other, root, render, waiting, seedFace: () => createThreadStore().save({ root, replies: [reply] }, reply.id, { [author]: { name: 'Nostrich', picture: 'https://example.com/nostrich.webp', eventAt: 10, t: Date.now(), thumbFor: 'https://example.com/nostrich.webp', thumb: 'data:image/png;base64,iVBORw0KGgo=', thumbPx: 144 }, - }), + }, { [reply.id]: { likes: 29, boosts: 7, sats: 210 } }), release: () => { for (const q of waiting.splice(0)) q.resolve(q.filter.ids ? [root] : []); }, overlay: () => { ui.profilePk = author; ui.profOverThread = true; render(); @@ -101,6 +101,19 @@ try { const row = document.querySelector('.thread-page [data-zap-post]'); return row?.textContent.includes('Nostrich') && row.querySelector('.note-avatar.ava-img')?.style.backgroundImage.includes('data:image/png;base64'); })); + check('cached likes, boosts and sats paint before relay replies', await page.evaluate(() => { + const row = [...document.querySelectorAll('.thread-page [data-zap-post]')] + .find((el) => el.dataset.zapPost === test.reply.id); + const buttons = row?.querySelectorAll('.note-acts > button'); + return buttons?.[1].textContent === '7' && buttons?.[3].textContent === '29' && buttons?.[4].textContent === '210'; + })); + await new Promise((r) => setTimeout(r, 450)); + check('an incomplete relay tally cannot erase the cached numbers', await page.evaluate(() => { + const row = [...document.querySelectorAll('.thread-page [data-zap-post]')] + .find((el) => el.dataset.zapPost === test.reply.id); + const buttons = row?.querySelectorAll('.note-acts > button'); + return buttons?.[1].textContent === '7' && buttons?.[3].textContent === '29' && buttons?.[4].textContent === '210'; + })); assert.deepEqual(errors, []); console.log('✓ no browser errors'); } finally { await browser.close(); server.stop(true); } -- cgit v1.2.3