mobx-utils icon indicating copy to clipboard operation
mobx-utils copied to clipboard

Question: How to use ObservableGroupMap in MST?

Open tho-graf opened this issue 5 years ago • 1 comments

Hi there,

I do my first little baby steps with mobx / MST and can't get ObservableGroupMap working with MST. Here is my example. I have an array in my state tree. This is by default an observable array, right? Is it correct to initialize the ObservableGroupMap in the view function once and read from it in a view function? Later I call the view function in an autorun. But the length of the (grouped) array is the same for ever.

https://codesandbox.io/s/competent-tu-1jyo8

Can anybody tell me what I am doing wrong?

Cheers Thomas

tho-graf avatar Nov 26 '20 21:11 tho-graf

I had a look at this. The issue seems to be that in MST, list.todos isn't actually an observable array of {done: boolean}, but rather a Proxy around an observable array of MST's ObjectNodes around {done: boolean}.

As far as I can see, for this to work, OGM would need to be changed to add explicit MST support.

NaridaL avatar Mar 13 '21 15:03 NaridaL