2 ms·
You should read some of the comments in that codebase. (Look for the constant MAX_REACTION_ITERATIONS). I don't know why you'd paint yourself into a corner like
by atoko 10y ago
You should read some of the comments in that codebase. (Look for the constant MAX_REACTION_ITERATIONS). I don't know why you'd paint yourself into a corner like that.
Just curious, how can you test a mobx store independently? (Sans components)
- true_religion 10y agoThat really depends on your architecture. The way I have it setup, everything is in a central store, and the components only access it rather than have observables for any kind of local state. Local state is handled with boring old setState calls, so the store and data-layer is totally independent of React, and can be tested without even importing the library. > (Look for the constant MAX_REACTION_ITERATIONS) Okay... that's interesting. It dates back to Feb. 2016th[1], and I'm not caught up with that version. My pull comes from January [2]. Giving it a brief look over, it looks like they changed the codebase to allow for reacts to trigger themselves. My version doesn't allow that. It's a fatal error instantaneously. Presumably, this was done to let people write recursive functions.... but I'm not 100% sure this is a good idea. Edit: I think my version implicitly has MAX_REACTION_ITERATIONS = 1, so observables triggering itself is an immediate error. [1] https://github.com/mobxjs/mobx/commit/a38b6a8c255d772a79daddb218e964c16629b6f9 https://github.com/mobxjs/mobx/commit/a38b6a8c255d772a79dadd... [2] I know I should update, but I come from the boring Python world where you don't expect the internals of a library to change too drastically year to year.