Description
Release beta.7 integrated the breaking change introduced by vue 3 release here. Unfortunately, this creates an issue in using the composition-api in vue 2.
Evan has 2 suggested fixes in the release notes for people using a plain object with refs:
-
Wrap the whole thing in reactive, which results in identical behavior as before. However, this doesn't work in the vue 2 api, as reactive mutates the underlying object, meaning those refs are unwrapped everywhere that they were being used or injected, and not just unwrapped in the newly assigned variable,
-
Just destructure the refs and return them specifically. Evan mentions that the only reason most people bundle refs together in a parent object is because of the verbosity of the return statement otherwise, which can me mitigated quite well by the new
<script setup>
RFC. This is a fair point, however, the<script setup>
functionality doesn't exist in Vue 2, so that is, once again, not an option for Vue2 users.
I'm honestly not sure what the answer here is, but that breaking change kind of put the users of this api in a bit of a maintainability bind. Any advice from the maintainers here would be greatly appreciated @pikax @antfu