-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Add @computedDisposable
, which automatically disposes the (heavy) computed data, such as an ui.Image
or other heavyweight resources
#860
Comments
@computedDisposable
, which automatically disposes the (heavy) computed data@computedDisposable
, which automatically disposes the (heavy) computed data, such as an ui.Image
or other heavyweight resources
I prefer not to mix lifecycle management of resources with core observables. Computed never holds a value, but only depends on other value holding observables. So fundamentally it's bringing irrelevant responsibility. Would not vote for this. You are bringing application level concepts here. Don't think it's the right place. Can you see if you can solve at the application layer? |
@pavanpodila Thanks for the reply! I agree and will not write code for the The reason is that, sometimes the computed value is heavy. It can be a big controller that has a Indeed, I have tried to implement it without modifying mobx source code, but all failed. (If you are interested I can post my non-working solution here). |
@pavanpodila I love mobx (and use it extensively!), but I see Riverpod has some features that are so great - this is the main reason I am adding this (and planning to add others) - to make mobx have fewer shortcomings compared with riverpod! (Surely mobx has a lot of other strengths :) ) |
How about using an Atom to track the usage and then dispose when there are no more observers? |
LGTM, I will revert it in #844 |
Example:
generates:
NOTE 1: Add this "disposeValue" automatically
NOTE 2: Add this "dispose" function
The text was updated successfully, but these errors were encountered: