aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/messages.js7
-rw-r--r--tools/nip29-group-test.js7
2 files changed, 13 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index d5c7943..0573def 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -18299,11 +18299,16 @@ export function messagesFeature(ctx) {
}) : null));
}
+ // Outside wnView: its own `const wn = gClient(g)` shadows the module's wn
+ // for the whole function, so a `!wn` in there read the inner one before
+ // it was set — a ReferenceError the moment a group was left from its own
+ // screen (Adam's phone, 2026-11-13).
+ const groupClientsLoading = () => !wn || wnLoading || !cd || cdLoading || !ng || ngLoading;
function wnView() {
const g = findGroup(ui.msgPeer);
if (!g) {
// the groups are still loading (a reload straight into this screen)
- if (!wn || wnLoading || !cd || cdLoading || !ng || ngLoading) { Promise.all([whiteNoise(), cordnChat(), nip29Chat()]).then(() => scheduleRepaint()); return h('div', { class: 'card col chat-card chat-page' }, h('span', { class: 'spinner' })); }
+ if (groupClientsLoading()) { Promise.all([whiteNoise(), cordnChat(), nip29Chat()]).then(() => scheduleRepaint()); return h('div', { class: 'card col chat-card chat-page' }, h('span', { class: 'spinner' })); }
ui.msgView = 'home';
return homeView();
}
diff --git a/tools/nip29-group-test.js b/tools/nip29-group-test.js
index de9b8e1..ddc7258 100644
--- a/tools/nip29-group-test.js
+++ b/tools/nip29-group-test.js
@@ -131,6 +131,13 @@ try {
let dead = '';
for (let i = 0; i < 60 && !/answering/.test(dead); i++) { dead = await p2.evaluate(() => [...document.querySelectorAll('.chat-thread-row')].find((r) => r.textContent.includes('deadgroup'))?.textContent || ''); if (!/answering/.test(dead)) await sleep(250); }
check("a group on a relay that's gone says so", /gone\.invalid isn't answering/.test(dead), dead.slice(0, 80));
+ // leaving it from its own screen ("Tried to leave but got this": a
+ // ReferenceError on the screen of a group that had just gone)
+ await p2.evaluate(() => [...document.querySelectorAll('.chat-thread-row')].find((r) => r.textContent.includes('deadgroup'))?.click()); await sleep(800);
+ await p2.click('[aria-label="Leave group"]'); await sleep(200);
+ await p2.click('[aria-label="Leave group"]'); await sleep(2500);
+ const after = await p2.evaluate(() => document.body.innerText);
+ check('leaving a group from its screen goes back to Messages', !/something broke/i.test(after) && !/deadgroup/.test(after) && /new group/i.test(after), after.slice(0, 120));
await ctx.close();
}