aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-28 22:25:57 -0700
committerAdam Soltys <[email protected]>2026-09-28 22:25:57 -0700
commit2bbff9ac91bf310f63216523cb418474ca64db64 (patch)
tree03caa49b71681537be5d8a5ee08f7d1cdcadfaf3 /tools
parentb1397fc6b0c6b91a0835911b9dd52c0b09432d56 (diff)
downloadcoinosv3-2bbff9ac91bf310f63216523cb418474ca64db64.tar.gz
coinosv3-2bbff9ac91bf310f63216523cb418474ca64db64.zip
A reloaded thread paints whole, quoted posts included, with no spinner.
The thread cache kept the replies but not the posts quoted inside them, so every reload showed "Fetching note…" until a relay answered. Quotes (of any kind — the one that showed it was a poll) are now saved with the thread and restored before the first paint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/thread-cache-test.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/thread-cache-test.js b/tools/thread-cache-test.js
index 485e874..38da691 100644
--- a/tools/thread-cache-test.js
+++ b/tools/thread-cache-test.js
@@ -19,7 +19,7 @@ check('a fresh store restores full content and tags by any viewed event', () =>
const long = { ...reply, content: 'x'.repeat(5000), tags: [...reply.tags, ['emoji', 'wave', 'https://example.com/wave.png']] };
store.save({ root, replies: [parent, long] }, long.id);
const restored = createThreadStore(storage).find(long.id);
- assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, counts: {}, replies: [long, parent] });
+ assert.deepEqual(restored, { rootId: root.id, root, profiles: {}, counts: {}, replies: [long, parent], quotes: [] });
assert.equal(store.find(parent.id).root.id, root.id);
});
check('thread authors keep their names and local avatar thumbnails across reloads', () => {
@@ -36,6 +36,12 @@ check('thread action totals are present before relay refresh and survive a conte
store.save({ root, replies: [parent, reply] }, reply.id);
assert.deepEqual(createThreadStore(storage).find(reply.id).counts[reply.id], { likes: 29, boosts: 7, sats: 210 });
});
+check('posts quoted inside the thread are restored with it, and a later save keeps them', () => {
+ const q = note(77), poll = { ...note(78), kind: 1068 }; // a quote can be any kind
+ store.save({ root, replies: [parent, reply] }, reply.id, {}, {}, [q, poll]);
+ store.save({ root, replies: [parent, reply] }, reply.id); // a relay refresh with no quotes resolved yet
+ assert.deepEqual(createThreadStore(storage).find(reply.id).quotes, [q, poll]);
+});
check('a large thread retains the selected reply and its ancestors', () => {
const siblings = Array.from({ length: 200 }, (_, i) => note(1000 + i, [['e', root.id, '', 'root']]));
store.save({ root, replies: [...siblings, parent, reply] }, reply.id);