composition-api: `toRaw()` doesn't expose Refs like in Vue 3
It seems like toRaw()
on a reactive object doesn’t expose the original properties like it does in Vue 3:
- Vue 3 example: isRef: true isReactive: false
- Vue 2 example: isRef: false isReactive: false
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 7
- Comments: 16 (1 by maintainers)
I’m unsure of what the correct fix is here since Vue 2 modifies the object in place with methods like
Vue.observable()
(used in reactive and ref) differently from Vue 3, which creates a Proxy (reactive(obj) != obj
). We could save a raw copy of the object passed toreactive()
but it would require a deep copy and could have a small perf implication.So, how to do with it?