diff --git a/packages/svelte/src/internal/client/reactivity/batch.js b/packages/svelte/src/internal/client/reactivity/batch.js index dcc02793ce..be1e6f2d82 100644 --- a/packages/svelte/src/internal/client/reactivity/batch.js +++ b/packages/svelte/src/internal/client/reactivity/batch.js @@ -532,6 +532,16 @@ export class Batch { // Mark is not guaranteed to not touch these, so we transfer them this.transfer_effects(batch.#dirty_effects); + for (const fn of batch.#commit_callbacks) { + this.#commit_callbacks.add(() => fn(batch)); + } + + for (const fn of batch.#discard_callbacks) { + this.#discard_callbacks.add(() => fn(batch)); + } + + this.settled().then(batch.#deferred?.resolve, batch.#deferred?.reject); + /** * mark all effects that depend on `batch.current`, except the * async effects that we just resolved (TODO unless they depend