mobxjs / mobx.dart

MobX for the Dart language. Hassle-free, reactive state-management for your Dart and Flutter apps.
https://mobx.netlify.app
MIT License
2.39k stars 310 forks source link

feat: add keepAlive to Computed #976

Closed amondnet closed 8 months ago

amondnet commented 8 months ago

Describe the changes proposed in this Pull Request.

This avoids suspending computed values when they are not being observed by anything (see the above explanation). Can potentially create memory leaks.

Fixes #975


Pull Request Checklist

netlify[bot] commented 8 months ago

Deploy Preview for mobx ready!

Name Link
Latest commit e3a7bc6a946dfd63e6bf5714a056488fd3320a6b
Latest deploy log https://app.netlify.com/sites/mobx/deploys/658c14dac3eefd0008978b02
Deploy Preview https://deploy-preview-976--mobx.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (00fe8b0) 99.00% compared to head (4f3a787) 99.01%.

:exclamation: Current head 4f3a787 differs from pull request most recent head e3a7bc6. Consider uploading reports for the commit e3a7bc6 to get more accurate results

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=YjGMFvwbrl&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs)](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) ```diff @@ Coverage Diff @@ ## main #976 +/- ## ======================================= Coverage 99.00% 99.01% ======================================= Files 57 57 Lines 2017 2024 +7 ======================================= + Hits 1997 2004 +7 Misses 20 20 ``` | [Flag](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | Coverage Δ | | |---|---|---| | [flutter_mobx](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | `100.00% <ø> (ø)` | | | [mobx](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | `98.56% <100.00%> (+<0.01%)` | :arrow_up: | | [mobx_codegen](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | `100.00% <100.00%> (ø)` | | | [mobx_lint](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | `∅ <ø> (∅)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) | Coverage Δ | | |---|---|---| | [mobx/lib/src/api/annotations.dart](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs#diff-bW9ieC9saWIvc3JjL2FwaS9hbm5vdGF0aW9ucy5kYXJ0) | `80.00% <100.00%> (ø)` | | | [mobx/lib/src/core/computed.dart](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs#diff-bW9ieC9saWIvc3JjL2NvcmUvY29tcHV0ZWQuZGFydA==) | `100.00% <100.00%> (ø)` | | | [mobx\_codegen/lib/src/store\_class\_visitor.dart](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs#diff-bW9ieF9jb2RlZ2VuL2xpYi9zcmMvc3RvcmVfY2xhc3NfdmlzaXRvci5kYXJ0) | `100.00% <100.00%> (ø)` | | | [mobx\_codegen/lib/src/template/computed.dart](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs#diff-bW9ieF9jb2RlZ2VuL2xpYi9zcmMvdGVtcGxhdGUvY29tcHV0ZWQuZGFydA==) | `100.00% <100.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs). Last update [00fe8b0...e3a7bc6](https://app.codecov.io/gh/mobxjs/mobx.dart/pull/976?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mobxjs).
pavanpodila commented 8 months ago

Pls resolve the conflicts as we merged the previous PR that bumped the version

amondnet commented 8 months ago

@pavanpodila I rebased to the main branch and resolved the conflict.