aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-29 07:05:47 -0700
committerAdam Soltys <[email protected]>2026-08-29 07:05:47 -0700
commitdd011c2c98033637829d83fc320ab4fdce4ede8c (patch)
tree67be07e6e8480354bfd60589ca68dbcaeac0c409 /src/features/messages.js
parentc4b566651d6afac2c48c88611094cfa71c16289b (diff)
downloadcoinosv3-dd011c2c98033637829d83fc320ab4fdce4ede8c.tar.gz
coinosv3-dd011c2c98033637829d83fc320ab4fdce4ede8c.zip
A round's output can no longer strand: every refresh asks the server to drop its unlock hash in the mailbox, and any device that finds such a breadcrumb with no matching action adopts the claim itself (input ids now read from the status response — the rescue needs no operator). History learns to tell the whole truth and nothing more: coins the server saw spent elsewhere get a folded row (skipping coins a known renewal consumed), renewals fold across devices on their unlock hash and appear only when they cost something, and a rescue records the fee the round actually took. The account page keeps its header icons when reached from an open wallet; the messages page folds the control/guestbook replay once per burst instead of painting every intermediate state — no more blinking messages from superseded ban lists or member counts crawling to their total, which now paints from last session's settled figure
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019WboeoetMF3MTmgT7Ew8yi
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index eea4fbf..d5c0441 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -263,6 +263,27 @@ export function messagesFeature(ctx) {
if (tms) observeAuthor(room.members, author, tms);
}
};
+ // The replay of stored wraps arrives one event at a time, and folding
+ // after every wrap paints each intermediate state: a superseded ban-list
+ // version blinks members' messages out until the newest version lands,
+ // and the member count creeps upward as joins stream in. Fold once per
+ // burst instead — a short quiet gap ends the burst — so the page goes
+ // from cache straight to the settled state.
+ let foldTimer = 0;
+ const scheduleFold = () => {
+ clearTimeout(foldTimer);
+ foldTimer = setTimeout(() => {
+ refold();
+ refoldGuestbook();
+ // remember the settled count — next session's list paints it
+ // immediately instead of "encrypted" flipping to a number
+ const s = st();
+ (s.memberCounts ||= {})[jm.community_id] =
+ [...room.members.values()].filter((m) => m.state === 'join').length;
+ save(s);
+ scheduleRepaint();
+ }, 250);
+ };
allUnsubs.push(
subscribeOn(room.relays, { kinds: [1059], authors: [room.control.pk], limit: 500 }, (wrap) => {
@@ -271,8 +292,7 @@ export function messagesFeature(ctx) {
const opened = openWrap(wrap, room.control);
if (!opened || opened.rumor.kind !== 3308) return;
room.controlEntries.push(opened);
- refold();
- scheduleRepaint();
+ scheduleFold();
}),
subscribeOn(room.relays, { kinds: [1059], authors: [room.guestbook.pk], limit: 500 }, (wrap) => {
if (seenWraps.has(wrap.id)) return;
@@ -280,8 +300,7 @@ export function messagesFeature(ctx) {
const opened = openWrap(wrap, room.guestbook);
if (!opened) return;
room.guestEntries.push(opened);
- refoldGuestbook();
- scheduleRepaint();
+ scheduleFold();
})
);
for (const c of jm.channels || []) subChannel(room, c.id);
@@ -2128,7 +2147,10 @@ export function messagesFeature(ctx) {
kids.push(h('div', { class: 'list' }, communities().map((jm) => {
const room = rooms.get(jm.community_id);
const name = room?.folded?.metadata?.name || jm.name;
- const memberCount = room ? [...room.members.values()].filter((m) => m.state === 'join').length : 0;
+ // until the guestbook fold lands, last session's settled count beats
+ // a placeholder that flips a moment later
+ const live = room ? [...room.members.values()].filter((m) => m.state === 'join').length : 0;
+ const memberCount = live || (st().memberCounts || {})[jm.community_id] || 0;
const unread = room ? roomUnread(room) : false;
return h('div', {
class: 'item chat-thread-row' + (unread ? ' unread' : ''),