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 { formatRelative, h } from '../core/dom.js';
|
||||
import {
|
||||
badge,
|
||||
@@ -346,6 +347,8 @@ export function render(host, { state }) {
|
||||
const level = state.me.accessLevel;
|
||||
const reload = () => render(host, { state });
|
||||
|
||||
autoRefresh(reload, { topics: ['community', 'discord', 'tick'] });
|
||||
|
||||
return renderAsync(
|
||||
host,
|
||||
async () => {
|
||||
|
||||
Reference in new issue
Block a user