Currently, I am working on a project that utilizes Vue along with Pinia store.
export default {
setup() {
let rows: Row[] = store.history.rows;
}
}
Everything is functioning properly at the moment, but there is a specific scenario where I need to modify and filter the array:
const filterArray = () => {
rows=store.history.rows;
for (let index = 0; index < rows.length; index++){
if (rows[index].department !== departmentModel.value) {
rows.splice(index, 1);
}
}
};
However, it seems like the filterArray
method is not only filtering the `rows` array but also impacting the `store.history.rows` array. Consequently, both arrays end up empty quickly.
My objective is to refresh the `rows` array every time the `filterArray` function is executed by replacing it with the entire content of the `store.history.rows` array and then implementing the necessary filtration based on the condition.
Can someone guide me on what might be going wrong in my current implementation?