sortablejs-vue3
sortablejs-vue3 copied to clipboard
Pinia state persistence
Apologies for this issue which seeks guidance more than raises code issues.
I have a list of objects in a Pinia store which I am accessing in the component via the standard storeToRefs(). These objects contain a property order which is used to specify the order within the list.
I first filter this list to remove an entry via a computed property like:
const filteredObjectList = computed({
get() {
return objectList.value.filter((obj) => {
return obj.id != 0;
})
},
set(newList) {
console.log(newList)
}
})
I have been able to produce the correct drag and drop behaviour via :list="filteredObjectList" item-key="order" and the list reorders properly. However the state does not seem to persist when the list is hidden and then shown again via a v-if clause. It is worth noting as well that the setter is never called.
Would you be able to provide some guidance on this non-persistence issue?