Log reactions used/invoked in data stores #3459
Replies: 2 comments
-
Hello, there is no dev tools for that. As far as I know there are no plans for implementing that. IMHO: I understand that it won't help you, but Mobx is all about automatic subscriptions / unsubscriptions, that's why reactions / autorun is not idiomatic way to write business logic with Mobx. For example I avoid reactions completely. There is also a warning in Mobx docs: https://mobx.js.org/reactions.html#use-reactions-sparingly |
Beta Was this translation helpful? Give feedback.
0 replies
-
See also https://mobx.js.org/analyzing-reactivity.html#spy, which allows
you to log trace which change fires which reaction, it will be quite a lot
of information, so might need some work to get to a digestible state. see
also https://www.npmjs.com/package/mobx-logger (not sure if it is still
maintained). Beyond that entirely subscribing Egors idiom here, reactions /
autorun should be pretty in most product code; if there is an clear event
that should trigger the side effect, that is much clearer than adding the
indirection through reactions.
…On Mon, Jul 11, 2022 at 3:48 PM Egor Gorbachev ***@***.***> wrote:
Hello, there is no dev tools for that. As far as I know there are no plans
for implementing that.
IMHO: I understand that it won't help you, but Mobx is all about automatic
subscriptions / unsubscriptions, that's why reactions / autorun is not
idiomatic way to write business logic in Mobx. For example I avoid
reactions completely. There is also a warning in Mobx docs:
https://mobx.js.org/reactions.html#use-reactions-sparingly
—
Reply to this email directly, view it on GitHub
<#3459 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBC52PYK43S5G4DYNEDVTQX3JANCNFSM53HQ4YJQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
shanky101
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a react codebase which is served as a web app and also bundled as an electron app. Due to a suspected memory leak (the app crashes after sustained usage of specific flows) there is a suspicion that a bunch of reactions fired are not cleaned (disposed) after usage. mobx dev tools does not seem to be reliable enough to surface this information.
We have a bunch of data stores which asynchronously fetch data through the lifecycle of the application. (Some on demand and some in background). Is there a way/mobx function/API which I can use to get an overview of all reactions fired and number of reactions in all the various stores in my application? The idea is to fix these egregious actions by cancelling or disposing them off.
Any pointers would be welcome!
Beta Was this translation helpful? Give feedback.
All reactions