|
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 |
|
@@ -160,7 +157,6 @@ export function boundary(node, props, boundary_fn) {
|
160 | 157 | if (!suspended_effect) {
|
161 | 158 | return;
|
162 | 159 | }
|
163 |
| - |
164 | 160 | if (boundary_effect) {
|
165 | 161 | destroy_effect(boundary_effect);
|
166 | 162 | }
|
@@ -205,12 +201,14 @@ export function boundary(node, props, boundary_fn) {
|
205 | 201 | }
|
206 | 202 |
|
207 | 203 | 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 | + }); |
214 | 212 | });
|
215 | 213 | }
|
216 | 214 | };
|
|
0 commit comments