isolateGlobalState: true
can cause conflicts that prevent observable registration
#3860
Labels
isolateGlobalState: true
can cause conflicts that prevent observable registration
#3860
Intended outcome:
A reaction should trigger when a dependent property updates when it's registered after calling
configure({ isolateGlobalState: true })
.Actual outcome:
If there are 2 properties that depend on the same shared property then it's possible that a call to
configure({ isolateGlobalState: true })
can prevent one of the properties from updating when the shared property updates.How to reproduce the issue:
Example Code: https://codesandbox.io/p/sandbox/vigorous-grass-j3v27n?file=%2Findex.js
Create an observable with 2 properties (
prop1
andprop2
for reference) that both depend on same shared property. Create a reaction onprop1
, callconfigure({ isolateGlobalState: true })
, create a reaction onprop2
. Change the shared property through an action and notice that onlyprop1
is updated whileprop2
does not update.Internally, the
globalState
maintains arunId
that is supposed to remain unique. Callingconfigure
will reset theglobalState.runId
allowing for 2 differentComputedValue
to have the samerunId_
and prevent registering a listener on a shared observable.Versions
mobx: 6.1.7, 6.12.3
The text was updated successfully, but these errors were encountered: