mobx-state-tree: Performing Actions on recently created objects on a reference does not trigger `onSnapshot` for the store.
I have:
- I think something is not working as it should.
- I’ve checked documentation and searched for existing issues
- I’ve made sure your project is based on the latest MST version
- Fork this code sandbox or another minimal reproduction.
- Describe expected behavior
- Describe observed behavior
I am running into an issue with performing an action on a reference not triggering the “onSnapshot” call in our store.
I am able to reproduce this in a simple store example: https://codesandbox.io/s/rrk8wojnp4
Observed behavior:
When loading the initial store, I want to perform an action on one selected todo. this selected todo is stored as a reference to a todo in the todos array. When I perform the toggle action using the reference you can see that there is no snapshot logged. Just a second later if I perform that same action directly on the item instead of via the reference, that action gets logged and can be stored.
Expected behavior: Performing an action on the referenced todo should trigger a snapshot, just the same as performing that action directly on the item.
I am still pretty new to this library so I might be misunderstanding how references are supposed to work or be used.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 18 (14 by maintainers)
Hi! Need to peek into the code… as far as I remember, emitting patches/snapshots come from quite different origins. Snapshot reaction was optimized in v3, so there must be a bug. Will look within this week