-
Features:
-
withServerConvexToken(token, fn)— new server-only helper (exported from@mmailaender/convex-svelte/sveltekit/server) that stores the auth token in request-scopedAsyncLocalStorage. Wrap your SvelteKitresolve()call with it inhooks.server.tsandconvexLoad/createConvexHttpClientwill automatically use the token during SSR — no more{ token: locals.token }boilerplate in every load function. -
Automatic server-side token for
convexLoad/convexLoadPaginated— when no explicit{ token }option is provided, the server path now falls back to the token set bywithServerConvexToken. This means+page.tsuniversal load functions can run authenticated queries during SSR without needing+page.server.ts. -
Automatic server-side token for
createConvexHttpClient— same fallback.createConvexHttpClient()(no args) now works in server load functions when the token context is set in the hook. -
New export path
@mmailaender/convex-svelte/sveltekit/server— server-only utilities that depend onnode:async_hooks. Currently exportswithServerConvexToken.
-
-
Unchanged:
- Explicit
{ token }option still takes priority (fully backward compatible). - Client-side navigation still uses the authenticated singleton (0.17.1 behavior).
- Explicit
- Fix: Use authenticated singleton ConvexClient for client-side initial fetches in
convexLoad()andconvexLoadPaginated()instead of creating new HTTP clients
- Features:
useMutation()/useAction()— thin wrappers that return callable functions for mutations and actions. They work in.sveltecomponents and plain.ts/.jsfiles.
-
Features:
convexLoadPaginated()— SSR-compatible paginated query loading. Fetches the first page on the server and automatically upgrades to a live paginated subscription on the client, withloadMore()support for incremental loading. Works with the SvelteKit transport hook, mirroring theconvexLoad()pattern for paginated queries.
-
Fixes:
- Add deferred subscription queue to prevent auth gap between transport.decode and setupAuth
- fix: Add
isLoading,error, andisStaleproperties toConvexLoadResultfor consistent query state interface
- fix: prevent flash of
nullquery results during SSR hydration- Call
client.setAuth()synchronously duringsetupAuth()initialization (before any$effectruns) when SSR confirms authentication. The Convex client'sAuthenticationManagerpauses the WebSocket during token fetch, preventing childuseQuerysubscriptions from hitting an unauthenticated WebSocket and overridinginitialDatawithnull. - Add a hydration guard in the reactive
$effect: while the synchronoussetAuthis active, skip all state transitions and avoid a redundantclient.setAuth()call. CallingsetAutha second time triggerssetConfig→_pauseSocket(), which closes and reopens the WebSocket — causing subscriptions to briefly receivenullfor auth-gated queries.
- Call
- Improvements
- Expose
UsePaginatedQuerytypes and consolidate API reference table with type exports
- Expose
-
Features:
- Authentication —
setupAuth()anduseAuth()for reactive auth state management, mirroring React'sConvexProviderWithAuthpattern. Includes SSR hydration viainitialStateoption. - getConvexClient() — retrieves the Convex client from a module-level singleton, working anywhere (
.ts,.svelte, hooks) as long assetupConvex()has been called first. - SvelteKit subpath (
convex-svelte/sveltekit) — new export with SvelteKit-specific features:convexLoad()— SSR data fetching that auto-upgrades to live subscriptions on the clientcreateConvexHttpClient()— server-side HTTP client helper with auth token supportgetConvexUrl()— retrieve the deployment URL set byinitConvex()orsetupConvex()
- Client singleton —
getConvexClient()for accessing theConvexClientfrom anywhere (.tsfiles, utility modules, hooks), not just Svelte components
- Authentication —
-
Improvements:
- Restructured README with expanded installation guide, client access patterns, SSR performance rationale, and API reference
- Features:
- Add experimental async query support with Svelte boundary integration