toRefs(proxyRefs(...)) works, but warns that toRefs() expects a reactive object but received a plain one

This issue has been created since 2022-08-15.

Version

2.7.8

Steps to reproduce

The following code

toRefs(proxyRefs({ foo: computed(() => 1) }))

prints a warning

vue.runtime.esm.js:4560 [Vue warn]: toRefs() expects a reactive object but received a plain one.

What is expected?

No warning

What is actually happening?

Warning in console

sodatea wrote this answer on 2022-08-15

I think it's expected behavior.

proxyRefs() does not return a reactive object.
Its type signature is ShallowUnwrapRef<T>, while reactive() returns an UnwrapNestedRefs<T>

It only happens to be the case that the toRefs()'s internal implementation can handle ShallowUnwrapRef<T>'s structure. But toRefs()'s documented usage is only to handle reactive objects.
So I think it's better to create a custom utility function to handle it than to reuse toRefs() for this purpose.

More Details About Repo
Owner Name vuejs
Repo Name vue
Full Name vuejs/vue
Language TypeScript
Created Date 2013-07-29
Updated Date 2022-09-27
Star Count 199644
Watcher Count 6098
Fork Count 32848
Issue Count 587

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Frequency label display is fixed instead of absolute, which causes it to "float" 2 2022-06-30 2022-09-11
Crashed when parse a video which in chinese directory name or include chinese chars video name 4 2022-04-27 2022-08-15
getting error 403 on my smaller image 0 2022-07-24 2022-08-20
Smart Monitor control works just like a TV but doesn't show up in HomeKit 2 2022-07-05 2022-08-20
Some errors were found that prevent to install this workbench: Some errors were found that prevent to install this workbench. Please install the missing components first. 7 2021-06-30 2022-09-18
Improve UI for validation of self-mapped tasks 5 2022-04-10 2022-07-31
Adding Listen, Whisper, and Barge 1 2021-10-18 2022-04-02
SSL_shutdown sometimes when putting caller on hold 4 2021-10-21 2022-04-02
Error with installation instructions 8 2013-12-31 2022-09-24
Extra line causing lambda to exit. 6 2022-02-06 2022-09-17
`default: uuid_generate_v4()` leads to crash during apply of migration for postgres 0 2022-08-02 2022-09-08
accent colour is reset when switching themes 0 2021-12-27 2022-07-31
Add support for toggleable 12 hour timestamps 1 2021-12-27 2022-09-02
imdbpy out of memory when call search_movie('1984") from s3 5 2020-12-02 2022-09-18
TalonFX encoder inversion not working 2 2021-01-23 2022-08-17
Could it possible to add a new listener? 2 2021-03-11 2022-09-24
Disney+ suddenly stopped working and reports "Error Code 83" on all devices 0 2021-04-08 2022-09-20
chore(deps-dev): bump eslint from 7.28.0 to 7.29.0 0 2021-06-21 2022-02-05
Applying NeuralProphet at Scale 1 2022-05-05 2022-09-20
faster_rcnn_r50 pretrained converted to ONNX hosted in Triton model server 2 2021-12-01 2022-09-14
Remove debug log of status and URL 2 2022-05-01 2022-09-15
Notification dashboard Takes lots of time to load applications. 0 2022-05-19 2022-09-08
账号有铜星,但在APP内表E无法搜索到里E内容 4 2020-12-12 2022-09-25
Alliance Space Guard 8 2022-04-03 2022-08-30
Players are described reacting to injury/burn/infection even when dead 1 2021-10-02 2022-08-26
Build failed due to use of deprecated Android v1 embedding. 0 2022-02-23 2022-09-16
About Alibaba Cloud init application template 0 2022-02-16 2022-09-20
3376 - InorderTraversal 0 2022-02-28 2022-07-20
Make obfuscated dll´s trim friendly 8 2022-07-22 2022-09-15
Can not delete resource 5 2021-10-09 2022-09-21
Bionic and threads 1 2016-04-23 2022-01-21
Event for restoration visits? 4 2017-01-20 2022-09-18
[Feature] extract version from target 7 2020-12-11 2022-07-09
SEGFAULT in ompi/opal/mca/btl/smcuda/btl_smcuda.c at *descriptor = NULL 16 2022-02-21 2022-09-12
Texdiag error 80070032 (ERROR_NOT_SUPPORTED) with 8BIT-LUMA(?) DDS 4 2021-04-01 2022-09-20
Positivity check in PDiagMat and ScalMat constructors? 1 2015-04-13 2022-09-12
How to set parameters in XR-Transformer training? 1 2022-08-01 2022-09-09
v1.7.19 - Seeming bug with innodb_buffer_pool_size + innodb_buffer_pool_instances suggestions 7 2020-05-05 2022-09-25
AttributeError: 'LightningDistributedModule' object has no attribute 'require_backward_grad_sync' 4 2021-10-22 2022-01-07
idea: integrate `cargo-generate` to provide a `maturin new` command 5 2021-09-01 2022-08-09
nx graph `--diff` to highlight changes between two branches 1 2022-09-18 2022-09-21
ModuleAttributeError: 'RobertaEmbeddings' object has no attribute 'position_ids' 10 2020-12-16 2022-09-15
Versioning scheme 7 2021-02-02 2022-01-21
Ability to extend CsrfGuardFilter 3 2021-03-03 2022-09-20
Provide support for stateless web applications 2 2020-05-04 2022-09-20
Performance jitter caused by getting rocksdb property during sending store heartbeat 2 2021-10-14 2021-12-31
persist: more robust handling of since capabilities 0 2022-09-22 2022-09-27
Redirect when selecting dapps page from search 0 2021-10-27 2022-07-18
TypeError: Class constructor LRUCache cannot be invoked without 'new' 2 2020-02-01 2022-09-23
daphne with django 3 16 2019-12-15 2022-08-07