vuejs / composition-api

Composition API plugin for Vue 2

Home Page:https://composition-api.vuejs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reactive([]) does not trigger computed

bkuster opened this issue · comments

Issue

When creating a reactive array and using it in a computed, changes to the array (using push etc.) does not trigger the computed property as expected.

See this code pen for a working example of this in Vue3.

{
  setup() {
    const foo = reactive([]);
    const bar = computed(() => foo.map(f => f));
    setTimeout(() => { foo.push(true); } , 1000);

    return {
      bar,
    };
  },
}
```

okay, so this is a known limitation and i have simply missread the documentation, assuming, if i have a reactive array, i will need refs within said array. sorry for the noise.