Skip to content

Help Error: [mobx-state-tree] assertion failed: cannot finalize the creation of a node that is already dead #2225

Answered by thegedge
xforcarlos asked this question in Q&A
Discussion options

You must be logged in to vote

I think it's the self.deleteOrder method you have in afterCreate (the one that's not in setTimeout).

The afterCreate is fired before a node is "finalized" (more of an internal detail, but hopefully that brings clarity to the error message). The problem is that it's getting destroy-ed before that happens, and hence the error message.

I think you could resolve this by doing the deleteOrder call in setTimeout(..., 0), because it will run (roughly) on the next tick of the event loop, after the object has had a chance to finalize.

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@xforcarlos
Comment options

@coolsoftwaretyler
Comment options

@xforcarlos
Comment options

Comment options

You must be logged in to vote
1 reply
@xforcarlos
Comment options

Answer selected by xforcarlos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants