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

refs in deep watch not working #752

Closed
webfansplz opened this issue Jul 7, 2021 · 0 comments · Fixed by #753
Closed

refs in deep watch not working #752

webfansplz opened this issue Jul 7, 2021 · 0 comments · Fixed by #753

Comments

@webfansplz
Copy link
Member

webfansplz commented Jul 7, 2021

Version: 1.0.0-rc.13

The reproduced demo is: https://codesandbox.io/s/sharp-lamarr-04z91

The main code is as follows:

<script>


import { watch, ref, computed, reactive } from "@vue/composition-api";

export default {
  name: "App",
  components: {
    HelloWorld,
  },
  setup() {
    const count = ref(0);
    const double = computed(() => count.value * 2);
    const state = reactive([count, double]);

    let dummy;
    watch(
      () => state,
      (state) => {
        dummy = [state[0].value, state[1].value];
      },
      { deep: true }
    );

    count.value++;
    console.log(dummy); // // output undefined.
  },
};
</script>
@webfansplz webfansplz changed the title refs in deep watch does'nt work refs in deep watch doesnt work Jul 7, 2021
@webfansplz webfansplz changed the title refs in deep watch doesnt work refs in deep watch not working Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant