Skip to content
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

triggerRef stopped working with watch-multiple #805

Closed
gkubisa opened this issue Aug 25, 2021 · 3 comments · Fixed by #808
Closed

triggerRef stopped working with watch-multiple #805

gkubisa opened this issue Aug 25, 2021 · 3 comments · Fixed by #808

Comments

@gkubisa
Copy link

gkubisa commented Aug 25, 2021

Since @vue/composition-api@1.1.2, triggerRef stopped triggering watch when watching an array of shallow refs. It appears to be caused by #791.

Here's a code sandbox demonstrating the issue. If you switch @vue/composition back to version 1.1.1, the same example will work correctly and consistently.

@webfansplz
Copy link
Member

@gkubisa @antfu I think this is the right behavior, aligned with Vue3.

vue3 CodeSandbox

@webfansplz
Copy link
Member

But they have different behaviors when value changed and set deep, I will take a pr to fix it

vue2 CodeSandbox

vue3 CodeSandbox

@webfansplz
Copy link
Member

@antfu

These are not the only problems. The following also don't work:

 const counter = shallowRef({ count: 0 });
    const counterOne = shallowRef(0);
    const counterMany = shallowRef(0);
    function trigger() {
      counter.value = { count: 0 };
    }

    //   should not trigger,but it triggered
    watch(counter, () => counterOne.value++);

CodeSandbox

Vue3 fix some issues about that,we don't aligned or we didn't find or fix them.

I'm not sure how we should fix it now, because some of it involves relatively big changes.such as :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants