feat(web): refresh the pages as the events arrive
One `EventSource` for the whole dashboard, held in a single slot: a view that re-renders itself would otherwise register a second listener each time and double the work on every event. A refresh landing under someone's fingers is worse than data a few seconds old, so it waits while a dialog is open or a field has focus, a burst of writes collapses into one reload, and a background tab closes its stream. The Discord page stays off the tick because listing members calls the Discord API. When the stream cannot be established a timer takes over. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
8 files changed
+255
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { api } from '../core/api.js';
|
||||
import { autoRefresh } from '../core/live.js';
|
||||
import { formatBytes, formatDuration, formatRelative, h } from '../core/dom.js';
|
||||
import { badge, card, grid, renderAsync, stat, table } from '../core/ui.js';
|
||||
|
||||
@@ -162,6 +163,10 @@ function systemCard(database, features) {
|
||||
}
|
||||
|
||||
export function render(host, { state }) {
|
||||
autoRefresh(() => render(host, { state }), {
|
||||
topics: ['tick', 'mutation', 'deployments', 'gitea', 'discord', 'community'],
|
||||
});
|
||||
|
||||
return renderAsync(
|
||||
host,
|
||||
() => api.get('/api/overview'),
|
||||
|
||||
Reference in new issue
Block a user