1
0

Enhance HUD dot functionality: add context validation and error handling, update member index from shared index if empty

This commit is contained in:
Chipperfluff 2026-01-20 08:01:00 +01:00
parent 5bbeac5e89
commit 7ccc73bf03

View File

@ -726,6 +726,8 @@ function ensureHudDot() {
}
function updateHudDot() {
if (contextInvalidated || !document?.body) return;
try {
const dot = ensureHudDot();
const panel = document.getElementById(HUD_PANEL_ID);
const total = sharedIndex.size;
@ -745,6 +747,9 @@ function updateHudDot() {
hudDirty = false;
lastHudSignature = signature;
}
} catch (error) {
contextInvalidated = true;
}
}
function flashHudDot() {
@ -906,6 +911,18 @@ function loadStoredIndex() {
data[STORAGE_KEY_MEMBER].forEach(item =>
sharedMemberIndex.set(item.id, item)
);
if (sharedMemberIndex.size === 0 && sharedIndex.size > 0) {
for (const item of sharedIndex.values()) {
sharedMemberIndex.set(item.id, {
id: item.id,
channelKey: item.channelKey,
channelLabel: item.channelLabel,
channelUrl: item.channelUrl,
lastSeen: item.lastSeen || Date.now()
});
}
schedulePersistMemberIndex();
}
updateHudDot();
}
);