Live updates keep the rows brought in with Load More (#17)
CI / Lint (eslint) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 14s
CI / Test (jest) (pull_request) Successful in 17s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m15s
CI / Integration (api) (pull_request) Successful in 4m1s
CI / UI (playwright) (pull_request) Successful in 4m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m38s
CI / Lint (eslint) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 14s
CI / Test (jest) (pull_request) Successful in 17s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 2m15s
CI / Integration (api) (pull_request) Successful in 4m1s
CI / UI (playwright) (pull_request) Successful in 4m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m38s
A live event reloaded only the first page of the Executions list, so rows brought in with Load More vanished whenever Gandalf or anyone else ran something. Live refreshes now fetch as many rows as are shown (up to the server's 1000); search and filters still start from the first page. The rest of #17 was already fixed: reloads are throttled (#10), each tab keeps its own state, and selections survive a refresh. The new UI test fails without this change (100 rows drop to 50). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
09a9d69102
commit
d299a351b7
2 files changed
+32
-4
No files matched your search
@@ -71,10 +71,13 @@
|
||||
/* ------------------------------------------------------------------
|
||||
Loading
|
||||
------------------------------------------------------------------ */
|
||||
async function loadView(view, append) {
|
||||
// keepLoaded: a live refresh fetches as many rows as are already shown, so
|
||||
// rows brought in with Load More don't vanish when an event arrives (#17).
|
||||
async function loadView(view, append, keepLoaded) {
|
||||
const st = state[view];
|
||||
const offset = append ? st.offset : 0;
|
||||
const params = new URLSearchParams({ limit: String(LIMIT), offset: String(offset) });
|
||||
const limit = keepLoaded ? Math.min(Math.max(LIMIT, st.rows.length), 1000) : LIMIT;
|
||||
const params = new URLSearchParams({ limit: String(limit), offset: String(offset) });
|
||||
if (view === 'manual') params.set('hide_internal', 'true');
|
||||
if (view === 'automated') params.set('only_internal', 'true'); // server-side (#4)
|
||||
const term = searchTerm();
|
||||
@@ -102,8 +105,12 @@
|
||||
await loadView(state.view, false);
|
||||
render();
|
||||
}
|
||||
// Live events trigger this; coalesce bursts into at most one reload per 2 s (#10).
|
||||
const reloadCurrent = Pulse.util.throttle(reloadNow, 2000);
|
||||
// Live events trigger this; coalesce bursts into at most one reload per 2 s (#10),
|
||||
// keeping however many rows are loaded (#17).
|
||||
const reloadCurrent = Pulse.util.throttle(async () => {
|
||||
await loadView(state.view, false, true);
|
||||
render();
|
||||
}, 2000);
|
||||
|
||||
// Typing in the search box: search on the server once typing pauses (#16).
|
||||
let searchTimer = null;
|
||||
|
||||
@@ -80,3 +80,24 @@ test('searching Executions finds a run by its command (#16)', async ({ page, req
|
||||
await expect(rows).toHaveCount(1);
|
||||
await expect(rows.first()).toHaveAttribute('data-execution-id', id);
|
||||
});
|
||||
|
||||
test('a live update keeps the rows brought in with Load More (#17)', async ({ page, request }) => {
|
||||
const workers = await (await request.get('/api/workers')).json();
|
||||
const id = workers.find(w => w.name === 'node-01').id;
|
||||
const send = () => request.post(`/api/workers/${id}/command`, { data: { command: 'true' } });
|
||||
for (let i = 0; i < 60; i++) await send();
|
||||
|
||||
await page.goto('/executions');
|
||||
const rows = page.locator('#ex-list-manual .ex-row');
|
||||
await expect(rows).toHaveCount(50);
|
||||
await page.getByRole('button', { name: 'Load More Executions' }).click();
|
||||
await expect.poll(() => rows.count()).toBeGreaterThan(50);
|
||||
const shown = await rows.count();
|
||||
|
||||
// A live event: the list refreshes with the new run on top, and still shows
|
||||
// as many rows as before rather than dropping back to the first 50.
|
||||
const marker = `live-${Date.now().toString(36)}`;
|
||||
await request.post(`/api/workers/${id}/command`, { data: { command: `echo ${marker}` } });
|
||||
await expect(rows.first()).toContainText(marker, { timeout: 10_000 });
|
||||
await expect(rows).toHaveCount(shown);
|
||||
});
|
||||
Reference in new issue
Block a user