[Vuejs]-Component doesn't update on pinia state change

3👍

The documentation states that, when "passing arguments" to a getter, that getter is not cached anymore (understand non-reactive) since it becomes a simple function that doesn’t change.

Therefore, you must use the computed composable to make it reactive, just as you would with any other function:

import { computed } from 'vue'
import { useSomeStore } from '@/stores/someStore'

const someStore = useSomeStore();
const foo = computed(() => someStore.getFilteredArray(props.someProp));
👤Vivick

2👍

it`s recommended to use the computed prop with the stores in general to be reactive :

<script setup>
import { useSomeStore } from '@/stores/someStore'
const someStore = useSomeStore();

// Define a computed property that tracks the getter
const foo = Vue.computed(() => someStore.getFilteredArray(props.someProp));
</script>

Leave a comment