I have an observable object, where I want to store some data. Keys are unique IDs for my customer entity, and values are arrays of customers' orders (which are objects themselves).
I initialize an object with:
@observable data = {};
Then, when I get data from network, I want to store them, using:
@action
saveData(customerId, ordersForCustomer) {
this.data = extendObservable(this.data, {
[customerId]: observable(ordersForCustomer);
}
}
Unfortunately, it seems my object (or its properties) are not being watched.
Why is this? And how can I fix this? Is there something special I need to know about how observable objects work with arrays as its values?