Skip to content

Commit 2620a21

Browse files
committed
tweak
1 parent b7c3995 commit 2620a21

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

packages/svelte/src/internal/client/dom/blocks/boundary.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ export class Boundary {
228228
});
229229
}
230230

231+
this.ran = false;
232+
231233
this.#main_effect = this.#run(() => {
232234
this.#is_creating_fallback = false;
233235

@@ -238,6 +240,8 @@ export class Boundary {
238240
}
239241
});
240242

243+
this.ran = true;
244+
241245
if (this.#pending_count > 0) {
242246
this.#show_pending_snippet();
243247
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ export function async_derived(fn, location) {
124124
var restore = capture();
125125

126126
var fork = active_fork;
127+
var ran = boundary.ran;
127128

128129
if (should_suspend) {
129-
if (fork !== null) {
130-
fork.increment();
131-
} else {
132-
// if nearest pending boundary is not ready, attach to the boundary
130+
if (!ran) {
133131
boundary.increment();
132+
} else {
133+
fork?.increment();
134134
}
135135
}
136136

@@ -144,10 +144,10 @@ export function async_derived(fn, location) {
144144
from_async_derived = null;
145145

146146
if (should_suspend) {
147-
if (fork !== null) {
148-
fork.decrement();
149-
} else {
147+
if (!ran) {
150148
boundary.decrement();
149+
} else {
150+
fork?.decrement();
151151
}
152152
}
153153

0 commit comments

Comments
 (0)