aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 90b080b..b3066c0 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -3699,8 +3699,15 @@ export function messagesFeature(ctx) {
// and unlike prefetching every row on paint (which cost sixty requests
// for twenty rows and starved the profile batch) this only ever asks
// about the person actually being tapped.
- node.addEventListener('pointerdown', () => { try { prefetchProfilePage(pk); } catch {} }, { passive: true });
- node.addEventListener('click', (e) => { e.stopPropagation(); openProfile(pk); });
+ // As on* properties claimed in _evs, the way h() attaches handlers, so
+ // the morph transplants them: a list that re-sorts (a new message
+ // lifting a conversation to the top) patches this node into a
+ // DIFFERENT person's avatar, and an addEventListener'd handler stayed
+ // behind holding the old person — a tap on Bill's row opened someone
+ // else's profile, until the next fresh render.
+ node.onpointerdown = () => { try { prefetchProfilePage(pk); } catch {} };
+ node.onclick = (e) => { e.stopPropagation(); openProfile(pk); };
+ (node._evs || (node._evs = new Set())).add('onpointerdown').add('onclick');
}
return hook('wrapAvatar', pk, node) || hatStamp(pk, node) || node;
};
@@ -12407,6 +12414,9 @@ export function messagesFeature(ctx) {
? h('div', { class: 'list' }, shownDms.map((row) => row.g ? wnGroupRow(row.g) : (({ peer, last, unread }) =>
h('div', {
class: 'item chat-thread-row' + (unread ? ' unread' : ''),
+ // keyed: a new message re-sorts the list, and the row moves
+ // with its person instead of being repainted as someone else
+ 'data-key': 'dm:' + peer,
onClick: () => { ui.msgView = 'dm'; ui.msgPeer = peer; ui.msgStick = true; render(); },
},
avatar(peer),
@@ -12838,6 +12848,7 @@ export function messagesFeature(ctx) {
for (const pk of wn.accounts(g).slice(0, 12)) profileOf(pk);
return h('div', {
class: 'item chat-thread-row' + (unread ? ' unread' : ''),
+ 'data-key': 'grp:' + g.id,
onClick: () => { ui.msgView = 'grp'; ui.msgPeer = g.id; ui.msgStick = true; ui.msgMembers = false; render(); },
},
h('div', { class: 'chat-avatar fallback' }, name.slice(0, 2)),