-
-
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
Provide an optional parameter for inferring @action/@computed/@observable #219
Comments
I like the
Would inference be all-or-nothing or could you still use annotations to override inference rules? |
Great idea @rrousselGit. Overall I like the direction. Few other things to consider:
|
@pavanpodila you often see ignore: true . so for computed it would be |
Agreed with ignore: true, IMO this is preferable to doubling the number of annotations. |
Ya like the |
It should be Anyway I agree with const noComputed = Computed(ignore: true); |
@shyndman I was thinking we can pick this up as a good enhancement for simplifying the use of MobX for most users. The current |
Yeah, I'm into it, along with the opt-out annotation. Maybe we could generalize the opt-outs into a single annotation? Something like @ignore()? |
I prefer the @ignore approach
…On 27 Dec 2019, 1:21 AM +0530, Scott Hyndman ***@***.***>, wrote:
Yeah, I'm into it, along with the opt-out annotations.
Maybe we could generalize the opt-outs into a single annotation? Something like @ignore()?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This proposal is for automatically inferring
@action/@computed/@observable
based on the type of the variable.The idea is, by letting the inference do its job, silly mistakes where we forgot to decorate a member can be stopped.
The inference would work using the following rules:
@computed
@obvervable
@observable
@action
This inference can be configured using two different ways:
@Store
decorator, for store specific overridebuild.yaml
file, for global configuration change:I've looked through the entire
mobx_examples
folder and all of the examples follows these rules.There are some exceptions, like in form_store.dart where
setupValidations
is not decorated.But
setupValidations
should probably be performed inside the constructor ofFormStore
and thereforesetupValidations
can be made private.Another exception is in github_store.dart, where
repositories
is not@obvervable
.But that seems dangerous considering
repositories
is mutated on multiple occasions and is used inside thebuild
method ofRepositoryListView
.The text was updated successfully, but these errors were encountered: