Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isolateGlobalState: true can cause conflicts that prevent observable registration #3860

Open
dbecks opened this issue Apr 18, 2024 · 0 comments
Labels

Comments

@dbecks
Copy link

dbecks commented Apr 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant