From 1d026b9288de2c2650c4589fccd96ba24531ac5f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 24 Oct 2025 10:45:50 -0400 Subject: [PATCH] add some minimal prose. probably don't need to go super deep here as it's not really meant for non-framework authors --- packages/svelte/src/internal/client/reactivity/batch.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index 89d5ad635b..6c8f24b3c9 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -875,6 +875,13 @@ export function eager(fn) { } /** + * Creates a 'fork', in which state changes are evaluated but not applied to the DOM. + * This is useful for speculatively loading data (for example) when you suspect that + * the user is about to take some action. + * + * Frameworks like SvelteKit can use this to preload data when the user touches or + * hovers over a link, making any subsequent navigation feel instantaneous. + * * @param {() => void} fn * @returns {{ commit: () => void, discard: () => void }} */