Skip to content

Conversation

Alfred-Skyblue
Copy link
Member

@Alfred-Skyblue Alfred-Skyblue commented Aug 7, 2024

fix #11532

Ref should be unwrapped when getting the value; otherwise, it can cause the following issues:

const b = ref(ref(1)) console.log(b.value) // 1 b.value = ref(2) console.log(b.value) // ref(2)

When we set a new ref to the ref setter, subsequent getter and setter operations will be handled by the new ref instead of the original ref. This is to maintain consistency with ref(ref(1)) returning ref(1). However, while the reference returned by ref(ref(1)) is the same, the setter ref involves two different refs:

const a = ref(0) const b = ref(a) console.log(a === b) // true b.value++ // a.value === b.value === 1 const c = ref(0) const d = ref() d.value = c console.log(c === d) // false d.value++ // d.value === c.value === 1
Copy link

github-actions bot commented Aug 7, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB (+63 B) 34.6 kB (+19 B) 31.2 kB (+16 B)
vue.global.prod.js 147 kB (+63 B) 54.1 kB (+20 B) 48.1 kB (+39 B)

Usages

Name Size Gzip Brotli
createApp 49.6 kB 19.5 kB 17.8 kB
createSSRApp 53.2 kB 21 kB 19.1 kB
defineCustomElement 51.9 kB 20.2 kB 18.5 kB
overall 63.2 kB (+74 B) 24.5 kB (+20 B) 22.3 kB (+20 B)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant