This commit is contained in:
SerKo 2025-05-05 20:38:32 +00:00 committed by GitHub
commit 66237ce7f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -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 able to trigger on 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)
})

View File

@ -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