You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide a minimal sample reproduction. Create a reproduction based on this sandbox
I created a minimal sample reproduction here: https://codesandbox.io/s/v8kkpjq8x7. If you remove isolateGlobalState: true from the configuration, then the "strict mode" errors start appearing in the console and the timer is no longer incremented. However, with isolateGlobalState: true in the configuration, no "strict mode" errors appear and the timer increments.
Did you check this issue wasn't filed before?
I started down this path because we ran into a situation where the "strict mode" errors were only being thrown when two instances of MobX existed on the page (which is only on a subset of pages in our application). Any page that only had one instance of MobX worked just fine (i.e. no "strict mode" errors). I noticed a couple closed issues (#1473 seems like the most relevant), but they all seemed to indicate that the issue was fixed.
We have automated tests covering the code path in our application that was modifying observables outside of an action, but the tests were not failing. I noticed that removing the isolateGlobalState configuration option caused the tests to start to fail, so I decided to see if I could reproduce this issue outside of our application...and here we are 😅
Elaborate on your issue. What behavior did you expect?
I expect that if I set enforceActions: 'always' then MobX will always enforce that observables must be modified in an action, regardless of whether isolateGlobalState is enabled or not.
State the versions of MobX and relevant libraries. Which browser / node / ... version?
I think you can see this from the code sandbox that I linked. One other data point: if I change the version of MobX in that sandbox to 4.1.0, then everything works as expected. I didn't exhaustively go through all MobX versions to figure out if others work / don't work, but we are using MobX 4.5.0 in our production application where we originally ran into this issue.
The text was updated successfully, but these errors were encountered:
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.
lockbot
locked as resolved and limited conversation to collaborators
Jul 21, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello! 👋
I have a:
I created a minimal sample reproduction here: https://codesandbox.io/s/v8kkpjq8x7. If you remove
isolateGlobalState: true
from the configuration, then the "strict mode" errors start appearing in the console and the timer is no longer incremented. However, withisolateGlobalState: true
in the configuration, no "strict mode" errors appear and the timer increments.I started down this path because we ran into a situation where the "strict mode" errors were only being thrown when two instances of MobX existed on the page (which is only on a subset of pages in our application). Any page that only had one instance of MobX worked just fine (i.e. no "strict mode" errors). I noticed a couple closed issues (#1473 seems like the most relevant), but they all seemed to indicate that the issue was fixed.
We have automated tests covering the code path in our application that was modifying observables outside of an action, but the tests were not failing. I noticed that removing the
isolateGlobalState
configuration option caused the tests to start to fail, so I decided to see if I could reproduce this issue outside of our application...and here we are 😅I expect that if I set
enforceActions: 'always'
then MobX will always enforce that observables must be modified in an action, regardless of whetherisolateGlobalState
is enabled or not.I think you can see this from the code sandbox that I linked. One other data point: if I change the version of MobX in that sandbox to 4.1.0, then everything works as expected. I didn't exhaustively go through all MobX versions to figure out if others work / don't work, but we are using MobX 4.5.0 in our production application where we originally ran into this issue.
The text was updated successfully, but these errors were encountered: