Skip to content

Commit fcaa8ce

Browse files
authored
fix: reapply new batch after #commit (#18186)
Fixes a regression of #18170 (not released yet therefore no changeset). `current_batch` is nulled out if the `#commit` rebases other branches, and that can lead to nullpointers down the line. No test right now but it's part of getting the failing SvelteKit test passing.
1 parent 908c9d0 commit fcaa8ce

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • packages/svelte/src/internal/client/reactivity

packages/svelte/src/internal/client/reactivity/batch.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ export class Batch {
363363
// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed
364364
if (async_mode_flag && !batches.has(this)) {
365365
this.#commit();
366+
// Rebases can activate other batches or null it out, therefore restore the new one here
367+
current_batch = next_batch;
366368
}
367369

368370
// Edge case: During traversal new branches might create effects that run immediately and set state,

0 commit comments

Comments
 (0)