Skip to content

Commit 2cd6b73

Browse files
committed
Merge branch 'experiment_s' into aa
2 parents e2bc4d9 + c7d3af1 commit 2cd6b73

File tree

1 file changed

+20
-22
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+20
-22
lines changed

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

+20-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @import { Effect, TemplateNode, } from '#client' */
22

3-
import { BOUNDARY_EFFECT, EFFECT_TRANSPARENT, INERT } from '../../constants.js';
3+
import { BOUNDARY_EFFECT, EFFECT_TRANSPARENT } from '../../constants.js';
44
import {
55
block,
66
branch,
@@ -81,22 +81,19 @@ export function boundary(node, props, boundary_fn) {
8181
var is_creating_fallback = false;
8282

8383
const render_snippet = (/** @type { () => void } */ snippet_fn) => {
84-
// Render the snippet in a microtask
85-
queue_micro_task(() => {
86-
with_boundary(boundary, () => {
87-
is_creating_fallback = true;
84+
with_boundary(boundary, () => {
85+
is_creating_fallback = true;
8886

89-
try {
90-
boundary_effect = branch(() => {
91-
snippet_fn();
92-
});
93-
} catch (error) {
94-
handle_error(error, boundary, null, boundary.ctx);
95-
}
87+
try {
88+
boundary_effect = branch(() => {
89+
snippet_fn();
90+
});
91+
} catch (error) {
92+
handle_error(error, boundary, null, boundary.ctx);
93+
}
9694

97-
reset_is_throwing_error();
98-
is_creating_fallback = false;
99-
});
95+
reset_is_throwing_error();
96+
is_creating_fallback = false;
10097
});
10198
};
10299

@@ -160,7 +157,6 @@ export function boundary(node, props, boundary_fn) {
160157
if (!suspended_effect) {
161158
return;
162159
}
163-
164160
if (boundary_effect) {
165161
destroy_effect(boundary_effect);
166162
}
@@ -205,12 +201,14 @@ export function boundary(node, props, boundary_fn) {
205201
}
206202

207203
if (failed) {
208-
render_snippet(() => {
209-
failed(
210-
anchor,
211-
() => error,
212-
() => reset
213-
);
204+
queue_micro_task(() => {
205+
render_snippet(() => {
206+
failed(
207+
anchor,
208+
() => error,
209+
() => reset
210+
);
211+
});
214212
});
215213
}
216214
};

0 commit comments

Comments
 (0)