aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/dashboard')
-rw-r--r--src/api/dashboard/dashboard.html9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html
index 0be3526..d173418 100644
--- a/src/api/dashboard/dashboard.html
+++ b/src/api/dashboard/dashboard.html
@@ -2810,7 +2810,11 @@ async function obtainTokens() {
}
}
// Follows `id`'s own links, again after a while if it fails (2 s, doubling to a minute).
+// Not this node itself (a subscription handed over from another node's page, where it
+// was another): its links and messages are the page's own already, and read twice
+// they'd show twice.
function follow(id, delay = 2000) {
+ if (state && id === state.node.id) return;
const old = subscribed.get(id);
if (old) old.stop();
const controller = new AbortController();
@@ -3552,7 +3556,7 @@ function ownMessagesArrived(list, sent) {
// sent): each message once. Each named by both ends (`from`, `to`) and the node that
// logged it (`node`), its number and exchange made its own (`node:seq`).
function remoteMessagesArrived(id, entry, list, sent) {
- if (!state) return;
+ if (!state || id === state.node.id) return;
noteStream(id, list, sent);
const self = state.node.id;
// Its messages come whole, those since the last event, up to the latest 500: one
@@ -4056,6 +4060,9 @@ function connect() {
remakesArrived();
if (treeShown && writerTree === null) loadTree();
if (token === null && tokenTimer === null) obtainTokens();
+ // Followed before the page knew which node it is: not any more.
+ const own = subscribed.get(state.node.id);
+ if (own) { own.stop(); subscribed.delete(state.node.id); }
for (const id of subscriptions) if (!subscribed.has(id)) follow(id);
});
events.addEventListener("patch", event => {