0
@click="filter.organization.splice(index, 1)"   

watch is ot detectng splice but works when the array is being populated

watch(
      () => filter.organization,
      (filter) => {
        console.log(filter, 'filter');
      }
    );
Salil Rajkarnikar
  • 588
  • 1
  • 7
  • 26
  • Hey, maybe you can see if this is the reason of your issue - https://stackoverflow.com/questions/74854103/vue-not-triggering-changes-inside-v-if-in-template-when-using-index/74860530#74860530 – Neha Soni Jan 05 '23 at 10:45

1 Answers1

1

The syntax you've used to create your watcher is specifically used to detect when filter.organization is replaced, not when modified. See the Vue documentation for more information.

To fire the watcher for every modification:

watch(filter, (newfilter, oldfilter) => {
  console.log(newfilter);
});

or modify your current watcher to include the deep option

watch(
  () => filter.organization,
  (filter) => {
    console.log(filter, "filter");
  },
  { deep: true }
);
yoduh
  • 7,074
  • 2
  • 11
  • 21