@@ -3,16 +3,19 @@ import {
33 type ReactiveEffectRunner ,
44 TrackOpTypes ,
55 TriggerOpTypes ,
6+ computed ,
67 effect ,
78 markRaw ,
89 reactive ,
910 readonly ,
11+ ref ,
1012 shallowReactive ,
1113 stop ,
1214 toRaw ,
1315} from '../src/index'
1416import { pauseScheduling , resetScheduling } from '../src/effect'
1517import { ITERATE_KEY , getDepFromReactive } from '../src/reactiveEffect'
18+ import { h , nextTick , nodeOps , render , serialize } from '@vue/runtime-test'
1619
1720describe ( 'reactivity/effect' , ( ) => {
1821 it ( 'should run the passed function once (wrapped by a effect)' , ( ) => {
@@ -1011,6 +1014,35 @@ describe('reactivity/effect', () => {
10111014 expect ( counterSpy ) . toHaveBeenCalledTimes ( 1 )
10121015 } )
10131016
1017+ // #10082
1018+ it ( 'should set dirtyLevel when effect is allowRecurse and is running' , async ( ) => {
1019+ const s = ref ( 0 )
1020+ const n = computed ( ( ) => s . value + 1 )
1021+
1022+ const Child = {
1023+ setup ( ) {
1024+ s . value ++
1025+ return ( ) => n . value
1026+ } ,
1027+ }
1028+
1029+ const renderSpy = vi . fn ( )
1030+ const Parent = {
1031+ setup ( ) {
1032+ return ( ) => {
1033+ renderSpy ( )
1034+ return [ n . value , h ( Child ) ]
1035+ }
1036+ } ,
1037+ }
1038+
1039+ const root = nodeOps . createElement ( 'div' )
1040+ render ( h ( Parent ) , root )
1041+ await nextTick ( )
1042+ expect ( serialize ( root ) ) . toBe ( '<div>22</div>' )
1043+ expect ( renderSpy ) . toHaveBeenCalledTimes ( 2 )
1044+ } )
1045+
10141046 describe ( 'empty dep cleanup' , ( ) => {
10151047 it ( 'should remove the dep when the effect is stopped' , ( ) => {
10161048 const obj = reactive ( { prop : 1 } )
0 commit comments