Repository navigation
UI: one EventSource module with one retry policy - #159
Merged
Merged
Conversation
LiveProvider owns the EventSource and applies every push through one table of event names. A first connect that fails now retries on the same steps as any other, the first open no longer refetches everything, and a push that cannot be applied is logged and its data fetched. The cancel and the set of a push are synchronous. hub/ becomes live/ and the tests drive a fake EventSource instead of FakeHub. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #146
What changed and why
hub/is nowlive/.LiveProviderowns the oneEventSourceand applies every push itself.live/push-table.tsis the singleeventName -> applytable and also gives the names to listen for. Removed:Dispatcher,useHubEvent,PushSource,HubPushes,FakeHub, the duplicated event-name list.downand waited for the Retry button.downnow means "away through every step"; it keeps retrying and Retry only skips the wait./api/auth/staterequest instead of two.console.error) and the keys it belongs to are invalidated.cancelQueriesreverts the query synchronously, read from query-core 5.105.1), so two pushes for one key land in order.EventSource(test/fake-event-source.ts, installed invitest.setup.ts); thehubthe harness returned is nowlive. Newtest/live.test.tsxcovers first-connect retry, down, no refetch on first open, one listener per event, back-to-back pushes and the two malformed cases.docs/decisions.md: no SSEid:andLast-Event-IDreplay. A reconnect refetch is a few small GETs on a LAN and replay would still need the refetch for a gap.Testing
pnpm --filter koppel.ui typecheck,pnpm --filter koppel.ui lint: clean.node:24.22.2-bookworm-slim, pnpm 9.15.0:pnpm --filter koppel.ui test: 6 files, 84 tests passed.Docs
docs/ui.md,CLAUDE.mdanddocs/decisions.mdupdated.Changelog notes: no wire, on-disk or settings change. User-visible: fewer requests at start-up, and the UI recovers by itself after a first connect that failed.
🤖 Generated with Claude Code