Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.

feat(solid-start): Convex reads ride the router's liveQuery in the browser - #6

Merged
ethan-huo merged 1 commit into
mainfrom
convex-live-layer
Sep 30, 2026
Merged

ethan-huo merged 1 commit into
mainfrom
convex-live-layer

Conversation

@ethan-huo

Copy link
Copy Markdown
Contributor

Follows https://github.com/celados/delta/pull/188, where the binding now lives in lib/solid/convex. The template copies it: web/src/lib/convex.ts and convex-server.ts match that module, minus createQueryStore (nothing here uses it).

What changes

  • Browser: a Convex read is a channel of @solidjs/router's liveQuery. Readers of the same question share one subscription, and a link preload warms it.
  • Server: unchanged in behaviour. The per-request reader still returns the same promise per question; the router's query() / liveQuery() do not settle a retried <Loading> (probe table in delta#188). serverConvex now takes the deployment URLs, passed in middleware.ts.
  • A Convex query error after a first value still reaches <Errored>; liveQuery would otherwise retry it with backoff.
  • A subscription opens and closes a microtask after its reader asks or leaves. Test fakes now wait for a subscriber before answering.
  • The extension imports this binding, so it now bundles the router's live layer: +7.6 kB unminified total output (301.8 → 309.4 kB). Its Vitest config inlines @solidjs/router.

Verification

  • bun run check passes: web 16 tests, extension 24 tests, typecheck, dead code.
  • The hydration-trace test now mirrors rc.10's subFetch (the compute runs under a Promise that never runs executors; the result is pulled only if it is its own iterator). Negative control: a source that opens its channel when called fails it.
  • Not run here: a production build against a Convex deployment (the template checkout has none). The same binding was measured in delta on a production build: a server-rendered, hydrated read held one subscription and released it on leaving the page.
  • Not run: the extension in a real browser.

…owser

Follows celados/delta#188 (lib/solid/convex). The browser half of the binding
is now a channel of @solidjs/router's liveQuery: readers of one question share
a subscription and a link preload warms it. The server half keeps its own
per-request promise; serverConvex takes the deployment URLs.

A subscription now opens and closes a microtask after its reader asks or
leaves; test fakes wait for a subscriber before answering.

Why: templates/solid-start/web/src/lib/convex-server.ts#function createServerConvex | query must return the same promise per (function, args) for the whole render; the router's query()/liveQuery() dedupe the request but return a new pending answer per call, which a retried <Loading> never settles on
Why: templates/solid-start/web/src/lib/convex.ts#const terminal | a Convex query error must carry a 4xx status, or liveQuery retries it with backoff forever and <Errored> never sees it
@ethan-huo
ethan-huo merged commit 727e85c into main Sep 30, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant