v0.13.0
Minor Changes
-
874612c: ### Features
- Authentication -
setupAuth()anduseAuth()for reactive auth state management. 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 helpers: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()
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.useMutation()/useAction()- thin wrappers that return callable functions for mutations and actions. They work in.sveltecomponents and plain.ts/.jsfiles.withServerConvexToken(token, fn)- new server-only helper (exported fromconvex-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.- Automatic server-side token for
convexLoad,convexLoadPaginated, andcreateConvexHttpClient- when no explicit{ token }option is provided, the server path falls back to the token set bywithServerConvexToken. - New export path
convex-svelte/sveltekit/server- server-only utilities that depend onnode:async_hooks. Currently exportswithServerConvexToken. - Skip support for
convexLoad/convexLoadPaginated- pass'skip'as args to avoid fetching. Useful for auth-gated queries that should not run when the user is unauthenticated.
Fixes
- Use authenticated singleton
ConvexClientfor client-side initial fetches inconvexLoad()andconvexLoadPaginated()instead of creating new HTTP clients. - Prevent flash of
nullquery results during SSR hydration by callingclient.setAuth()synchronously duringsetupAuth()initialization. - Add deferred subscription queue to prevent auth gap between
transport.decodeandsetupAuth. - Add
isLoading,error, andisStaleproperties toConvexLoadResultfor consistent query state interface.
Improvements
- Expose
UsePaginatedQuerytypes and consolidate API reference table with type exports. - Raise peer dependency floors to
convex@^1.30.0andsvelte@^5.19.0.convex-svelterelies on Convex 1.30.0 behavior for paginated query SSR hydration, and on Svelte 5.19.0 compiler fixes for TypeScript/runes syntax. - Explicit
{ token }option still takes priority (fully backward compatible). Client-side navigation still uses the authenticated singleton. - Restructured README with expanded installation guide, client access patterns, SSR performance rationale, and API reference.
Docs
- Fully reworked documentation with complete examples and in-depth explanations covering all features.
- Added guidance on choosing between
+page.ts(universal) and+page.server.ts(server-only) forconvexLoad.
- Authentication -