I have defined an action for removing an item from an array:
export default class myStore {
@observable items = [];
...
...
@action deleteItem = async (target) => {
try {
await backendService.deleteItem(target.id);
runInAction(() => {
const targetIndex = this.items.indexOf(target);
this.items.splice(targetIndex, 1);
});
} catch (error) {
...
}
};
...
...
}
Altough I made my component an observer
, it still doesn't update my list until I trigger some other actions (click, rename, etc), in that case I will be able to see the item has been removed.
Am I missing something?