gaba3535
Remove item from store list?
Just passing by to share with you guys:
this conversation allowed me to understand better how solid Stores works,
then i finally got to delete an entry from Store list (
createStore([])
):
- i was setting the entry as undefined, thinking it would delete it from the array, But it was just changing the value to undefined
and not changing the length.
- so returning a new array in setStore()
fixed it
so thanks a lot!
-----------------
TL;DR: fixed remove a item from Store of array by
- replacing setStore(it => it.id === matchingId, undefined);
with setStore(list => list.filter(it => it.id != matchingId))
(sharing in case anyone have the same problem)30 replies