-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
refactor: remove toRaw(ref) in triggerRefValue #9082
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
Conversation
Size ReportBundles
Usages
|
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
CI has failed. Could you please check |
I'm not sure why ci fails, but judging from the vue source code, it is indeed unnecessary to perform |
Sorry, I messed up the ecosystem-ci comment 🤦♂️ |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
I believe the While I think this makes sense in the case of The only way I could find to do this was by explicitly calling A follow up question is: what harm does it do if we don't remove the wrapper? If we don't unwrap the ref, then the values of Inside With that in mind, I created the following examples in the Playground: With the current Perhaps someone else can think of a simpler (less contrived) example, but I guess my point is just that this change is not simply a refactor, it does have an observable impact on how Vue behaves in edge cases. |
There have been significant changes to the reactivity system since this PR was opened, but the With the new reactivity system, code like this will fail if we remove the import { readonly, shallowRef, triggerRef, watchEffect } from 'vue'
const msg = readonly(shallowRef(''))
watchEffect(() => {
// ...
triggerRef(msg)
}) The Quite why somebody would want to trigger a ref via a It would be nice to have a test for this edge case, but I think this change should be closed. |
It is not necessary to do
toRaw(ref)
for aRefBase<any>
type