You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're getting "This object has died and is no longer part of a state tree." error when passing a mobx-state-tree object as a prop and merging the map containing the products with a map (literal object) that has an object with the same key. We call merge() for the map where the object (product) is stored in an action (self.products.merge({ ...})).
Full error
Error: [mobx-state-tree] This object has died and is no longer part of a state tree. It cannot be used anymore. The object (of type 'ProductCollectionPropertyElement') used to live at '/productStore/products/149900/collection/column/elements/0'. It is possible to access the last snapshot of this object using 'getSnapshot', or to create a fresh copy using 'clone'. If you want to remove an object from the tree without killing it, use 'detach' instead.
Code causing the issue
The error is thrown in the line with const status = productCollection.getRowStatus( below.
@aripekkako if you could introduce a minimal reproduction that would be great!
I did find and PR a fix for a bug in map reconcilation today, related to either using numbers as identifier, or using the .put method. See #693. It might be related, but I cannot be entirely sure about that without a test that I can add to the test suite :)
Short description
We're getting "This object has died and is no longer part of a state tree." error when passing a mobx-state-tree object as a prop and merging the map containing the products with a map (literal object) that has an object with the same key. We call
merge()
for the map where the object (product) is stored in an action (self.products.merge({ ...})
).Full error
Code causing the issue
The error is thrown in the line with
const status = productCollection.getRowStatus(
below.What have we tried?
clone
anddetach(clone())
for the object.The text was updated successfully, but these errors were encountered: