-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
When used with unistore
is impossible to delete / remove a nested object or property.
See the following example ( This code only works using unistore
without stockroom
)
// Store
const state = {
collections: {
items: {
a: { ... },
b: { ... },
c: { ... },
}
// ...
}
// ...
}
// Action
removeItem({ collections }, id) {
let items = collections.items;
// Remove item
if (items[id]) {
const { [id]: removed, ...rest } = items;
items = rest;
}
return { collections: { ...collections, items } };
},
Unistore only example (working demo)
Metadata
Metadata
Assignees
Labels
No labels