mobx-state-tree icon indicating copy to clipboard operation
mobx-state-tree copied to clipboard

safeReference invalidates on old subtree destroying

Open Amareis opened this issue 5 years ago • 2 comments

Bug report

  • [X] I've checked documentation and searched for existing issues
  • [X] I've made sure my project is based on the latest MST version
  • [X] Fork this code sandbox or another minimal reproduction.

Sandbox link or minimal reproduction code https://codesandbox.io/s/mobx-state-tree-broken-reference-example-c7tum

Describe the observed behavior When safeReference points to some model in subtree, then subtree detached and new subtree attached with same id model (here safeReference points to new subtree) and then old subtree destroyed, safeReference will be reset to undefined, but it shouldn't.

Describe the expected behavior If safeReference points to new subtree, then old, already detached, subtree destroying should not affect this reference.

Amareis avatar Jan 18 '20 09:01 Amareis

Maybe #1052 is related somehow.

Amareis avatar Jan 18 '20 09:01 Amareis

Hey @Amareis - thanks for the issue, and I'm sorry no one got back to you for so long. I'm going to label this as a bug and see if I can work with the maintainers to figure out a solution.

I know it's been years, so if this isn't relevant to you any longer, I totally get it. But if you're interested in helping, I'd be happy to collaborate a little.

coolsoftwaretyler avatar Jun 30 '23 21:06 coolsoftwaretyler