`isolateGlobalState: true` can cause conflicts that prevent observable registration
dbecks opened this issue · comments
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
and prop2
for reference) that both depend on same shared property. Create a reaction on prop1
, call configure({ isolateGlobalState: true })
, create a reaction on prop2
. Change the shared property through an action and notice that only prop1
is updated while prop2
does not update.
Internally, the globalState
maintains a runId
that is supposed to remain unique. Calling configure
will reset the globalState.runId
allowing for 2 different ComputedValue
to have the same runId_
and prevent registering a listener on a shared observable.
Versions
mobx: 6.1.7, 6.12.3