Replies: 2 comments 2 replies
-
Sorry, most of it has been written 5+ years ago, so the details are not top
of mind. (Why care?) probably has to do with updates not immediately
starting new reactions but waiting until the current one is finished. If
you want to know more, I recommend to disable the lines and run the unit
tests, likely some will fail.
…On Fri, 8 Sept 2023, 21:53 dSalieri, ***@***.***> wrote:
I watched code base of Reaction class and some his dependencies and I've
seen the next:
/// I omitted detailed codetrack() {
startBatch();
trackDerivedFunction(this, fn, undefined);
endBatch();}
function trackDerivedFunction(derivation, f, context) {
globalState.inBatch++;
f.call(context);
globalState.inBatch--;}
So my question is the next: Why does the track method have batch
operations, if we have operations inBatch++, inBatch-- inside
trackDerivedFunction?
If startBatch and endBatch has important sense in track, please explain
it, desirable with examples on real examples.
—
Reply to this email directly, view it on GitHub
<#3754>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBCHSV3JBPR7R23ACOTXZNZSFANCNFSM6AAAAAA4Q2R6YQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Check out the repo, yarn, yarn test
…On Sat, 9 Sept 2023, 07:40 dSalieri, ***@***.***> wrote:
@mweststrate <https://github.com/mweststrate> Only one operation runs the
track method (via onInvalidate_) and this is runReaction_ (it also has
startBatch and endBatch). So I thing the track method has useless batch
operations (my opinion) and probably trackDerivedFunction also has
unnesessary inBatch increment and decrement.
*Tell me how I can run the tests you are talking about.*
P.S I am investigating mobx architecture and I what to know how this works.
—
Reply to this email directly, view it on GitHub
<#3754 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBC6BP5NKYGM2VQ2XBDXZP6OLANCNFSM6AAAAAA4Q2R6YQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I watched code base of
Reaction
class and some his dependencies and I've seen the next:So my question is the next: Why does the
track
method have batch operations, if we have operationsinBatch++
,inBatch--
insidetrackDerivedFunction
?If
startBatch
andendBatch
has important sense intrack
, please explain it, desirable with examples on real examples.Beta Was this translation helpful? Give feedback.
All reactions