@@ -3,16 +3,19 @@ import {
3
3
type ReactiveEffectRunner ,
4
4
TrackOpTypes ,
5
5
TriggerOpTypes ,
6
+ computed ,
6
7
effect ,
7
8
markRaw ,
8
9
reactive ,
9
10
readonly ,
11
+ ref ,
10
12
shallowReactive ,
11
13
stop ,
12
14
toRaw ,
13
15
} from '../src/index'
14
16
import { pauseScheduling , resetScheduling } from '../src/effect'
15
17
import { ITERATE_KEY , getDepFromReactive } from '../src/reactiveEffect'
18
+ import { h , nextTick , nodeOps , render , serialize } from '@vue/runtime-test'
16
19
17
20
describe ( 'reactivity/effect' , ( ) => {
18
21
it ( 'should run the passed function once (wrapped by a effect)' , ( ) => {
@@ -1011,6 +1014,35 @@ describe('reactivity/effect', () => {
1011
1014
expect ( counterSpy ) . toHaveBeenCalledTimes ( 1 )
1012
1015
} )
1013
1016
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
+
1014
1046
describe ( 'empty dep cleanup' , ( ) => {
1015
1047
it ( 'should remove the dep when the effect is stopped' , ( ) => {
1016
1048
const obj = reactive ( { prop : 1 } )
0 commit comments