Skip to content

Commit 30cd46d

Browse files
committed
more
1 parent 63be623 commit 30cd46d

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { loop } from '../../loop.js';
4747

4848
export class Boundary {
4949
suspended = false;
50+
inert = false;
5051

5152
/** @type {Boundary | null} */
5253
parent;
@@ -106,13 +107,7 @@ export class Boundary {
106107
this.parent = /** @type {Effect} */ (active_effect).b;
107108

108109
this.#effect = block(() => {
109-
var boundary_effect = /** @type {Effect} */ (active_effect);
110-
boundary_effect.b = this;
111-
112-
// @ts-ignore We re-use the effect's fn property to avoid allocation of an additional field
113-
boundary_effect.fn = (/** @type {unknown} */ input) => {
114-
this.error(input);
115-
};
110+
/** @type {Effect} */ (active_effect).b = this;
116111

117112
if (hydrating) {
118113
hydrate_next();

packages/svelte/src/internal/client/runtime.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,19 @@ export function check_dirtiness(reaction) {
252252
* @param {Effect} effect
253253
*/
254254
function propagate_error(error, effect) {
255-
/** @type {Effect | null} */
256-
var current = effect;
255+
var boundary = effect.b;
257256

258-
while (current !== null) {
259-
if ((current.f & BOUNDARY_EFFECT) !== 0) {
257+
while (boundary !== null) {
258+
if (!boundary.inert) {
260259
try {
261-
// @ts-expect-error
262-
current.fn(error);
260+
boundary.error(error);
263261
return;
264262
} catch {
265-
// Remove boundary flag from effect
266-
current.f ^= BOUNDARY_EFFECT;
263+
boundary.inert = true;
267264
}
268265
}
269266

270-
current = current.parent;
267+
boundary = boundary.parent;
271268
}
272269

273270
is_throwing_error = false;
@@ -278,10 +275,7 @@ function propagate_error(error, effect) {
278275
* @param {Effect} effect
279276
*/
280277
function should_rethrow_error(effect) {
281-
return (
282-
(effect.f & DESTROYED) === 0 &&
283-
(effect.parent === null || (effect.parent.f & BOUNDARY_EFFECT) === 0)
284-
);
278+
return (effect.f & DESTROYED) === 0 && (effect.parent === null || !effect.b || effect.b.inert);
285279
}
286280

287281
export function reset_is_throwing_error() {

0 commit comments

Comments
 (0)