developit / developit/stockroom
Can't delete nested object from store
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
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` )
``` JSX
// 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)
[](https://codesandbox.io/s/k6v6j6y97?fontsize=14)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.