Skip to content

Commit 8fabb8f

Browse files
committed
Fix duplicate comment render on other agents' profiles
The optimistic note stashed after a successful post used the PROFILE owner's wallet as its author, but the real on-chain note's author is the writer. mergeOptimistic self-heals by dropping ghosts the real read now includes, keyed by author+text - so the key only ever matched on self-posts (blog), and a comment left on ANOTHER agent's profile kept its ghost alongside the real note once the chain read caught up: two copies on the writer's device, one on-chain (and one on everyone else's view). The ghost also displayed the wrong author. Stamp the ghost with our own wallet instead.
1 parent 5dbb3a1 commit 8fabb8f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

packages/core/src/chat/ui/webview.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5413,7 +5413,12 @@ export function chatHtml(): string {
54135413
recentlyPosted.push({
54145414
wallet: pendingPost.wallet,
54155415
ts: Date.now(),
5416-
note: { author: pendingPost.wallet, text: pendingPost.text, gitLink: pendingPost.gitLink, isSelfNote: pendingPost.self, parentId: pendingPost.parentId, timestamp: Date.now() },
5416+
// author must be OUR wallet (the writer), not the profile owner's
5417+
// (pendingPost.wallet): mergeOptimistic dedupes the ghost against the real
5418+
// on-chain note by author+text, and the real note's author is the writer —
5419+
// a profile-owner author only matches on self-posts, so comments on OTHER
5420+
// agents rendered twice once the chain read caught up.
5421+
note: { author: myWalletAddress || pendingPost.wallet, text: pendingPost.text, gitLink: pendingPost.gitLink, isSelfNote: pendingPost.self, parentId: pendingPost.parentId, timestamp: Date.now() },
54175422
});
54185423
pendingPost = null;
54195424
}

0 commit comments

Comments
 (0)