File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 8
8
reactive ,
9
9
readonly ,
10
10
ref ,
11
+ shallowRef ,
11
12
toRaw ,
13
+ triggerRef ,
12
14
} from '../src'
13
15
14
16
/**
@@ -520,3 +522,16 @@ describe('reactivity/readonly', () => {
520
522
expect ( r . value ) . toBe ( ro )
521
523
} )
522
524
} )
525
+
526
+ test ( 'should be able to trigger with triggerRef' , ( ) => {
527
+ const r = shallowRef ( { a : 1 } )
528
+ const ror = readonly ( r )
529
+ let dummy
530
+ effect ( ( ) => {
531
+ dummy = ror . value . a
532
+ } )
533
+ r . value . a = 2
534
+ expect ( dummy ) . toBe ( 1 )
535
+ triggerRef ( ror )
536
+ expect ( dummy ) . toBe ( 2 )
537
+ } )
Original file line number Diff line number Diff line change @@ -93,6 +93,12 @@ export class Dep {
93
93
*/
94
94
sc : number = 0
95
95
96
+ /**
97
+ * @internal
98
+ */
99
+ readonly __v_skip = true
100
+ // TODO isolatedDeclarations ReactiveFlags.SKIP
101
+
96
102
constructor ( public computed ?: ComputedRefImpl | undefined ) {
97
103
if ( __DEV__ ) {
98
104
this . subsHead = undefined
You can’t perform that action at this time.
0 commit comments