From 86d5609a188ce4dae248d1b56c4563bae299af31 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 28 Sep 2026 22:53:37 -0700 Subject: A thread that starts from a poll (or any non-kind-1 post) is cached too, so a reload paints its replies at once. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The thread store accepted only kind 1 and silently skipped saving a thread rooted in a kind 1068 poll — every refresh then waited on the relays behind a spinner. Also guard the profile Back listener for window-less tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Du1qT1wbkYwYK6zkGH79Rp --- tools/thread-cache-test.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/thread-cache-test.js') diff --git a/tools/thread-cache-test.js b/tools/thread-cache-test.js index 38da691..e8b0ccf 100644 --- a/tools/thread-cache-test.js +++ b/tools/thread-cache-test.js @@ -22,6 +22,14 @@ check('a fresh store restores full content and tags by any viewed event', () => assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, counts: {}, replies: [long, parent], quotes: [] }); assert.equal(store.find(parent.id).root.id, root.id); }); +check('a thread rooted in a poll (kind 1068) is kept too', () => { + const poll = { ...note(40), kind: 1068, tags: [['option', '0', 'Yes!'], ['option', '1', 'No!']] }; + const answer = note(41, [['e', poll.id, '', 'root']]); + store.save({ root: poll, replies: [answer] }, poll.id); + const restored = createThreadStore(storage).find(poll.id); + assert.equal(restored?.root.kind, 1068); + assert.deepEqual(restored.replies, [answer]); +}); check('thread authors keep their names and local avatar thumbnails across reloads', () => { const thumb = 'data:image/webp;base64,AAAA'; const face = { name: 'Nostrich', picture: 'https://example.com/face.webp', eventAt: 50, -- cgit v1.2.3