close #12803
@@ -8,7 +8,9 @@ import {
reactive,
readonly,
ref,
+ shallowRef,
toRaw,
+ triggerRef,
} from '../src'
/**
@@ -520,3 +522,16 @@ describe('reactivity/readonly', () => {
expect(r.value).toBe(ro)
})
+
+test('should be able to trigger with triggerRef', () => {
+ const r = shallowRef({ a: 1 })
+ const ror = readonly(r)
+ let dummy
+ effect(() => {
+ dummy = ror.value.a
+ })
+ r.value.a = 2
+ expect(dummy).toBe(1)
+ triggerRef(ror)
+ expect(dummy).toBe(2)
+})
@@ -93,6 +93,12 @@ export class Dep {
*/
sc: number = 0
+ /**
+ * @internal
+ */
+ readonly __v_skip = true
+ // TODO isolatedDeclarations ReactiveFlags.SKIP
constructor(public computed?: ComputedRefImpl | undefined) {
if (__DEV__) {
this.subsHead = undefined