mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-03 19:33:43 +00:00
fix(dashboard): account history reloads without a script error
The account page throttled its account_notes watcher around the check of which account changed, but a throttled call gets no event, so every change threw "Cannot read properties of undefined (reading 'id')" and the history never reloaded. The check now runs first and only the reload is throttled. Check: lock or unlock an account (or add a note from another tab): the history list on its page updates, and the browser console shows no error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -592,7 +592,11 @@ if (document.getElementById('noteForm')) {
|
||||
if (del && confirm('Delete this entry from the history?')) api.action('/api/account_notes/' + del.dataset.deleteNote + '/delete', {}).then(loadNotes).catch(function () {});
|
||||
});
|
||||
loadNotes();
|
||||
if (window.Live) Live.on('account_notes', Live.throttle(function (e) { if (!e.id || e.id === String(accountId)) loadNotes(); }, 1000));
|
||||
// Only changes to this account's history; throttled after that check, since a throttled call gets no event
|
||||
if (window.Live) {
|
||||
var reloadNotes = Live.throttle(loadNotes, 1000);
|
||||
Live.on('account_notes', function (e) { if (!e.id || String(e.id) === String(accountId)) reloadNotes(); });
|
||||
}
|
||||
}
|
||||
function toggleLock(locked) {
|
||||
if (!confirm((locked ? 'Lock' : 'Unlock') + ' this account?')) return;
|
||||
|
||||
Reference in New Issue
Block a user