fix(reactivity): triggerRef
working with toRef
from reactive
#7507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
triggerRef
allows forcing update the ref created byref
andshallowRef
, but not the one fromtoRef
.For example
It's because the ref created by
toRef
did not forward the.dep
attribute. This PR fixes it.Playground Before:
https://sfc.vuejs.org/#eNp9kU1ugzAQha8y8gaiEGi7RCRSr1B16Q2BISENtjU2tBLy3Ts2JU1bqRvwvHn+PD+zeDYmn0YUpahsQ71xYNGN5iBVPxhNDmYg7DL+1I3rJ8yg0YMZHbYZOOpPJ6SXkHc6/hR+uNe+eQMPHekBEmYnUknVaGWZ7WqHsL/R0hk6rUt4BL9ZPSywI/LS6M8gYS1hA8BqavSoXAR16cOPzLEm1tci03QD+wPMwRHv5FN9HRG226AQt0oqvLjIUoUypFq7uL/93WzKfrYFa1UsQ+NxceBwMFcumCOAqu2nAxdTwjzHoryviqDdkqNp2RzzSzveQ2rPery2cER42qz+qriRRSaWveyG2uQXqxVvLtYnvxJWCkYGJWg8/hBLcXbO2LIobNeEfV9srulU8CknfrofMEc77I6k3y0Sg6XI7hgFixPSjlC1SEj/MX9Z/3AD1vP4hP8EmTTcTA==
Playground After:
https://deploy-preview-7507--vue-sfc-playground.netlify.app/#eNqlUcFOwzAM/RUrl3WiaQEJIU1lEr+AOObSte4WaJPISTumqv+O09Ex4MillZ9f3nu2R/HsXDb0KDai8BVpF8Bj6N1WGd05SwFGIGxS/pRV0AOmUNnO9QHrFALp/R7pJfaDnX8GP8Krrt5hgoZsByvWXimjTGWNZ+1QBoSni1oyQmPtBu5gWi8cBpgx6yUzP4UVYysmACykyvYmzEJNcvujsyuJ8SVkkqzhaQtjZMxvsqFse4Sbm4gQj0omOp5hZWIMZZYprl9/D5swn2mRWuTnpfG6uAjYuZYDcwVQ1HrYcpgNjOMcapqKPGKXZu9qJs/98zjTBIk/2L6tYYdwv174RX5RFqk430V2pcvevDV8uTmf+mp4JVgyIhHj9cdaiUMIzm/yvEbX2pN0hIPGo3x8uH2UklnSN5Vkj9OeOEudGQytbk5Z6VzO7Yw4oO4wQ9/JHdmjR2J7JdIrp5zBAUkSmhoJ6f/OvwT/uEfziU8hpk8bZPfk