Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the reactive and the shallowReactive shield each other, so code not work as expect #3177

Closed
Akimotorakiyu opened this issue Feb 6, 2021 · 1 comment

Comments

@Akimotorakiyu
Copy link

Akimotorakiyu commented Feb 6, 2021

Version

3.0.5

Steps to reproduce

import { reactive, shallowReactive, watchEffect } from 'vue'

const a = { name: 'rakiyu', friends: ['friend1'] }

const sa = shallowReactive(a)
const ra = reactive(a)

console.log(sa === ra) // true, the reactive status depending on reactive or shallowReactive which run first, the === will always true

const f = ra.friends

watchEffect(() => {
  console.log(...f)
})

ra.friends.push('friend2') // will not triger console.log

What is expected?

log out friend2

What is actually happening?

not log

@Akimotorakiyu Akimotorakiyu changed the title the reactive and shallowReactive shield each other, so code not work as expect the reactive and the shallowReactive shield each other, so code not work as expect Feb 6, 2021
@HcySunYang
Copy link
Member

Duplicate of #2843

@HcySunYang HcySunYang marked this as a duplicate of #2843 Feb 6, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants