fix(ui): always refresh contact data on path_changed event

The path_changed socket handler was skipping the refresh when Contact
Info modal was closed. This meant contactsList stayed stale, so opening
the modal later still showed outdated path info. Now always refreshes
contactsList on any path_changed event.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-28 07:32:33 +01:00
parent 5df9b4b4a2
commit 9be7ae6cc4

View File

@@ -121,16 +121,9 @@ function connectChatSocket() {
updateStatus(data.connected ? 'connected' : 'disconnected');
});
// Real-time path change — refresh Contact Info if open for this contact
// Real-time path change — always refresh contactsList, re-render modal if open
chatSocket.on('path_changed', async (data) => {
const modalEl = document.getElementById('dmContactInfoModal');
if (!modalEl || !modalEl.classList.contains('show')) return;
const currentPubkey = getCurrentContactPubkey();
if (!currentPubkey) return;
const changedKey = (data.public_key || '').toLowerCase();
if (changedKey && changedKey.startsWith(currentPubkey.toLowerCase())) {
await refreshContactInfoPath();
}
await refreshContactInfoPath();
});
}