-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shallow unwrapping creates a feature parity problem with Vue3 #536
Comments
With the vue2 limitations it makes it really difficult, unfortunately I don't have a good solution, it would be possible to create an copy of the object and unwarp the values (similar to |
@pikax Has anyone considered backporting the |
That SFC is still in RFC vuejs/rfcs#182 I wouldn't expect it to be ported until is merged |
This is not a part of this plugin, should be handled by vue-compiler. You can continue the discussion in the corresponding RFC or the vuejs/vue repo. Closing for now. Thanks. |
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
The text was updated successfully, but these errors were encountered: