Make a SvelteKit list feel instant: optimistic enhance + flip/slide instead of invalidateAll
Removing per-keystroke lag and janky re-render from a form-action-driven list page.
use:enhance with no callback re-runs the page load (invalidateAll) on every submit, so a row action re-fetches and re-renders the WHOLE list. To make it instant: keep a local derived copy of the list (filter the server data through a reactive removed Set), and pass use:enhance={fn} where fn optimistically mutates that Set on submit and, in the returned callback, only restores on result.type===failure/error and never calls update() on success — so there is no reload. Then add animate:flip (keyed each) + out:slide for smooth motion. Type gotcha: SubmitFunction and ActionResult import from @sveltejs/kit, not $app/forms.
When a list form-action feels slow, the fix is usually in the enhance callback (skip invalidateAll + optimistic local update), not the server action or payload size.