|
1 | 1 | /** @import { Effect, TemplateNode, } from '#client' */
|
2 | 2 |
|
3 |
| -import { BOUNDARY_EFFECT, EFFECT_TRANSPARENT, INERT } from '../../constants.js'; |
| 3 | +import { BOUNDARY_EFFECT, EFFECT_TRANSPARENT } from '../../constants.js'; |
4 | 4 | import {
|
5 | 5 | block,
|
6 | 6 | branch,
|
@@ -81,22 +81,19 @@ export function boundary(node, props, boundary_fn) {
|
81 | 81 | var is_creating_fallback = false;
|
82 | 82 |
|
83 | 83 | 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; |
88 | 86 |
|
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 | + } |
96 | 94 |
|
97 |
| - reset_is_throwing_error(); |
98 |
| - is_creating_fallback = false; |
99 |
| - }); |
| 95 | + reset_is_throwing_error(); |
| 96 | + is_creating_fallback = false; |
100 | 97 | });
|
101 | 98 | };
|
102 | 99 |
|
@@ -203,12 +200,14 @@ export function boundary(node, props, boundary_fn) {
|
203 | 200 | }
|
204 | 201 |
|
205 | 202 | if (failed) {
|
206 |
| - render_snippet(() => { |
207 |
| - failed( |
208 |
| - anchor, |
209 |
| - () => error, |
210 |
| - () => reset |
211 |
| - ); |
| 203 | + queue_micro_task(() => { |
| 204 | + render_snippet(() => { |
| 205 | + failed( |
| 206 | + anchor, |
| 207 | + () => error, |
| 208 | + () => reset |
| 209 | + ); |
| 210 | + }); |
212 | 211 | });
|
213 | 212 | }
|
214 | 213 | };
|
|
0 commit comments