Skip to content
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

Missing an error / warning when using computed value outside a reaction #961

Closed
1 task done
adamkleingit opened this issue Apr 23, 2017 · 1 comment
Closed
1 task done

Comments

@adamkleingit
Copy link
Member

adamkleingit commented Apr 23, 2017

Hi,
is there a way to throw out an error / warning if using a computed value outside of a reaction / autorun?
Maybe as an option to useStrict to be backwards compatible?

Is there any reason to allow using computed values outside a reaction? Sounds like this should be a default behaviour

This is a silent issue at the moment that can cause performance issues.
If we use a computed value directly and forget to wrap it with an observer / autorun / reaction - it will work regularly, and we wouldn't know that it's being recalculated over and over again.

  • Idea
@adamkleingit adamkleingit changed the title Error / Warning when using computed value outside a reaction Missing an error / warning when using computed value outside a reaction Apr 23, 2017
@mweststrate
Copy link
Member

Mobx 4 will introduce mobx.configure({ warnOnUnsafeComputationReads: true })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants