You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call defineProps like this const { ...props } = defineProps()
Put props into toRefs toRefs(props))
Note
this works fine const props = defineProps() toRefs(props))
What is expected?
No warning
What is actually happening?
A warning appears [Vue warn] toRefs() expects a reactive object but received a plain one.
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered:
avinean
changed the title
[Vue warn] toRefs() expects a reactive object but received a plain one.
While putting destructured props into toRefs the warning appears [Vue warn] toRefs() expects a reactive object but received a plain one.
Apr 8, 2025
const{...props}=defineProps()// compiled to const props = _createPropsRestProxy(__props, [])console.log(props)// props is a plain objectconstprops=defineProps()console.log(props)// props is a Proxy
const{ someProp1, someProp2, ...props}=defineProps<{myProp: string}>()provide('context',{extraValue1: 1,extraValue2: 2,// ...props this won't work so I need toRefs
...toRefs(props)// this works fine, but warning appears})
Vue version
3.5.13
Link to minimal reproduction
https://play.vuejs.org/#eNqFkj1PwzAQhv+K5SWtFDlChaUKSIA6wABVYbSEquRSXBLbsp1Qqep/585JSocWtvt4znrvPe/5vbWia4HPee4Lp2xgHkJr76RWjTUusEfTWFY507BEZJQQnkidZz2PJCYBGluvA2DGWF6qLgYYxvGsL2d9Pc9OaJ7y4AujK7URW280CtkTLHmBk6oG92qDMtpLPmexQ711XZvv51gLroV0rBefUHydqW/9jmqSLx14cB1IfuyFtdtA6NuLtxfYYXxsNqZsa6T/aK7Am7oljT320OoSZZ9wUe1TtFPpzbtf7AJoPy5FQok8RF5ytJdMu7T6r9yZuI5zUh/QxfE0ly+5Z8GsoPIps850qgScHS7bn1RqPIQnUAiBjPUI3LISKqVhSflkStQwPkkQD2hJkg4vT+LQFKH/fseZv4A7fHTgyBfcYSZuxNWMH34AEnfgZw==
Steps to reproduce
defineProps
like thisconst { ...props } = defineProps()
props
intotoRefs
toRefs(props))
Note
this works fine
const props = defineProps() toRefs(props))
What is expected?
No warning
What is actually happening?
A warning appears [Vue warn] toRefs() expects a reactive object but received a plain one.
System Info
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: