Closed ZFail closed 1 year ago
use
this.aref?.maybeCurrent
instead of
this.aref?.current
or use isValid before accessing current if the referenced object might cease to exist
why reference is not valid? i`m deleting model with id '2'? not '1'
Because a[1] holds a reference to id "1" through the rootstore (that's why it is called a "root" reference), but when a[1] gets detached from the root store then a[1] cannot "reach" a[0] (id: 1) through its root (which has become none) and therefore the reference becomes null
thanks
this sample
causes
[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[Autorun@166]' Error: a reference of type 'aRef' could not resolve an object with id '1'