@@ -243,8 +243,10 @@ function propagate_error(error, effect) {
243
243
if ( ( current . f & BOUNDARY_EFFECT ) !== 0 ) {
244
244
try {
245
245
// @ts -ignore
246
- current . fn ( { error } ) ;
246
+ current . fn ( error ) ;
247
247
} catch {
248
+ // Remove boundary flag from effect
249
+ current . f ^= BOUNDARY_EFFECT ;
248
250
current = parent ;
249
251
continue ;
250
252
}
@@ -485,7 +487,7 @@ export function update_effect(effect) {
485
487
dev_effect_stack . push ( effect ) ;
486
488
}
487
489
} catch ( error ) {
488
- handle_error ( /** @type {Error } */ ( error ) , effect , previous_component_context ) ;
490
+ handle_error ( /** @type {Error } */ ( error ) , effect , previous_component_context || effect . ctx ) ;
489
491
} finally {
490
492
active_effect = previous_effect ;
491
493
@@ -565,22 +567,28 @@ function flush_queued_effects(effects) {
565
567
for ( var i = 0 ; i < length ; i ++ ) {
566
568
var effect = effects [ i ] ;
567
569
568
- if ( ( effect . f & ( DESTROYED | INERT ) ) === 0 && check_dirtiness ( effect ) ) {
569
- update_effect ( effect ) ;
570
-
571
- // Effects with no dependencies or teardown do not get added to the effect tree.
572
- // Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we
573
- // don't know if we need to keep them until they are executed. Doing the check
574
- // here (rather than in `update_effect`) allows us to skip the work for
575
- // immediate effects.
576
- if ( effect . deps === null && effect . first === null && effect . nodes_start === null ) {
577
- if ( effect . teardown === null ) {
578
- // remove this effect from the graph
579
- unlink_effect ( effect ) ;
580
- } else {
581
- // keep the effect in the graph, but free up some memory
582
- effect . fn = null ;
570
+ if ( ( effect . f & ( DESTROYED | INERT ) ) === 0 ) {
571
+ try {
572
+ if ( check_dirtiness ( effect ) ) {
573
+ update_effect ( effect ) ;
574
+
575
+ // Effects with no dependencies or teardown do not get added to the effect tree.
576
+ // Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we
577
+ // don't know if we need to keep them until they are executed. Doing the check
578
+ // here (rather than in `update_effect`) allows us to skip the work for
579
+ // immediate effects.
580
+ if ( effect . deps === null && effect . first === null && effect . nodes_start === null ) {
581
+ if ( effect . teardown === null ) {
582
+ // remove this effect from the graph
583
+ unlink_effect ( effect ) ;
584
+ } else {
585
+ // keep the effect in the graph, but free up some memory
586
+ effect . fn = null ;
587
+ }
588
+ }
583
589
}
590
+ } catch ( error ) {
591
+ handle_error ( /** @type {Error } */ ( error ) , effect , effect . ctx ) ;
584
592
}
585
593
}
586
594
}
@@ -653,8 +661,14 @@ function process_effects(effect, collected_effects) {
653
661
if ( ( flags & RENDER_EFFECT ) !== 0 ) {
654
662
if ( is_branch ) {
655
663
current_effect . f ^= CLEAN ;
656
- } else if ( check_dirtiness ( current_effect ) ) {
657
- update_effect ( current_effect ) ;
664
+ } else {
665
+ try {
666
+ if ( check_dirtiness ( current_effect ) ) {
667
+ update_effect ( current_effect ) ;
668
+ }
669
+ } catch ( error ) {
670
+ handle_error ( /** @type {Error } */ ( error ) , current_effect , current_effect . ctx ) ;
671
+ }
658
672
}
659
673
660
674
var child = current_effect . first ;
0 commit comments