Remote Functions Patterns
Live examples for SvelteKit 3 remote functions: query, command, form and prerender
Reading data
Top-level await
Using {#await query()} directly in template
Direct .current access
Accessing query().current property in script
Derived reactive query
Using $derived() to create reactive queries
Manual refresh
Calling .refresh() method on demand
pending, ready & loading new
Built-in status for queries, commands and forms
Batched queries
Multiple queries batched into a single network request
Live queries new
Streaming server data with query.live()
Prerendered data new
prerender() turns remote functions into static files
Waterfall loading
Anti-pattern: each query waits for the previous result
Writing data
Forms
Form pattern
Using form() with progressive enhancement
Advanced form pattern
Nested objects, arrays, files, validation, and more
Input types new
Radios, checkbox groups, multi-selects and ranges with typed values
Client-side preflight new
Validate in the browser with .preflight(schema)
Server-side validation new
Business rules reported per field with invalid()
Multiple submit buttons new
One form, two actions via .as('submit', value)
Multiple form instances new
One form per list item with .for(id)