~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

Pages hear a repository change and a check end, live

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:serve/live-events-data

What changes

A repository's pages now draw themselves again when a pull, comment, push or check is written about the repository, as they were meant to. A check's page now sees its run end without a reload. /_live/repo's changed and /_live/check's ended now carry null as their data.

Why

Both events were sent with empty data, and axum writes no data: line for that. The server-sent events spec has a browser drop an event with no data without dispatching it. So no page ever heard changed, and the check page never heard ended. curl prints the lines all the same, which is how earlier checks of the stream passed. Every other event already carries JSON, so null keeps them alike.

How it was checked

On knotless.dev, Chromium headless had the pull page's /_live/repo stream open while a comment was posted. curl received changed within 3 seconds, and getThread already had the comment. The page made no request and never showed the comment. A second EventSource opened in the page got no changed either. a_run_shows_as_it_runs now waits for each event with its data: line, so it fails against the old server.

Shortcomings

The test reads the stream as text, not through a browser's EventSource, so it catches this only by checking for the data line.

Changeset: none

Approved

This sends null as the data of the changed and ended events, so a browser's EventSource dispatches them. axum writes no data: line for empty data, and the browser drops an event that has none. The fix is correct and small. The change is in live.rs.

The client listeners for both events in web/src/lib/live.ts ignore the payload, so null can't break them. docs/reference/api.md is updated to match. a_run_shows_as_it_runs now waits for the data: null line, so it fails against the old server.

I read the diff and the client code but didn't run anything.

Merged as 8d48f4e