@@ -8,11 +8,12 @@ import {
8
8
cloneVNode ,
9
9
mergeProps ,
10
10
normalizeVNode ,
11
- transformVNodeArgs
11
+ transformVNodeArgs ,
12
+ isBlockTreeEnabled
12
13
} from '../src/vnode'
13
14
import { Data } from '../src/component'
14
15
import { ShapeFlags , PatchFlags } from '@vue/shared'
15
- import { h , reactive , isReactive , setBlockTracking , ref } from '../src'
16
+ import { h , reactive , isReactive , setBlockTracking , ref , withCtx } from '../src'
16
17
import { createApp , nodeOps , serializeInner } from '@vue/runtime-test'
17
18
import { setCurrentRenderingInstance } from '../src/componentRenderContext'
18
19
@@ -614,6 +615,29 @@ describe('vnode', () => {
614
615
] ) )
615
616
expect ( vnode . dynamicChildren ) . toStrictEqual ( [ ] )
616
617
} )
618
+ // #5657
619
+ test ( 'error of slot function execution should not affect block tracking' , ( ) => {
620
+ expect ( isBlockTreeEnabled ) . toStrictEqual ( 1 )
621
+ const slotFn = withCtx (
622
+ ( ) => {
623
+ throw new Error ( 'slot execution error' )
624
+ } ,
625
+ { type : { } , appContext : { } } as any
626
+ )
627
+ const Parent = {
628
+ setup ( _ : any , { slots } : any ) {
629
+ return ( ) => {
630
+ try {
631
+ slots . default ( )
632
+ } catch ( e ) { }
633
+ }
634
+ }
635
+ }
636
+ const vnode =
637
+ ( openBlock ( ) , createBlock ( Parent , null , { default : slotFn } ) )
638
+ createApp ( vnode ) . mount ( nodeOps . createElement ( 'div' ) )
639
+ expect ( isBlockTreeEnabled ) . toStrictEqual ( 1 )
640
+ } )
617
641
} )
618
642
619
643
describe ( 'transformVNodeArgs' , ( ) => {
0 commit comments