Skip to content

Commit e0c90fb

Browse files
committed
fix, albeit one i don't fully understand
1 parent 4e0c795 commit e0c90fb

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ function capture() {
7373
var previous_effect = active_effect;
7474
var previous_reaction = active_reaction;
7575
var previous_component_context = component_context;
76+
var previous_batch = current_batch;
7677

7778
return function restore() {
7879
set_active_effect(previous_effect);
7980
set_active_reaction(previous_reaction);
8081
set_component_context(previous_component_context);
82+
previous_batch?.activate();
8183

8284
if (DEV) {
8385
set_from_async_derived(null);
@@ -176,8 +178,8 @@ export function unset_context() {
176178
* @param {() => Promise<void>} fn
177179
*/
178180
export async function async_body(fn) {
179-
const unsuspend = suspend();
180-
const active = /** @type {Effect} */ (active_effect);
181+
var unsuspend = suspend();
182+
var active = /** @type {Effect} */ (active_effect);
181183

182184
try {
183185
await fn();

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,10 @@ export function suspend() {
680680
batch.decrement();
681681
}
682682

683+
if (batch === current_batch) {
684+
batch.deactivate();
685+
}
686+
683687
unset_context();
684688
};
685689
}

0 commit comments

Comments
 (0)