Continuing our Remote Functions series with commands. Unlike forms, command functions let you manipulate data without a form element, perfect for button clicks and other JavaScript-driven interactions. Import command from $app/server in a .remote.ts file, define a schema for validation and type safety, then call it directly from your component.
By default, commands do not refresh any queries, giving you full control over what updates. Add a refresh call to fetch new data alongside the mutation using the same single-flight pattern from form functions: one round trip to the server gets you the mutation plus fresh data. Type-safe, input-validated, and ready for those interactive dashboard moments.
Read the docs: https://svelte.dev/docs/kit/remote-fu...