-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove inferring argumentless functions to computed properties in observable
#532
Comments
So this change will mark the beginning of 3.0.0? On Sep 1, 2016 4:21 PM, "Michel Weststrate" notifications@github.com
|
Sounds like a welcome change. In my case it shouldn't even break anything. I usually only pass pure data into |
@mweststrate, just to make it clear, we replacing syntax like this: observable({
x: () => this.y
}); with equal alternative: observable({
x: computed(() => this.y)
}); right? |
Both are still supported, first will be deprecated by this story, idiomatic will be: observable({
get x() { return this.y }
}); Biggest advantage is that it avoids subtle errors with |
@mweststrate, basically, ability to define getter in current context may be very useful, and thats how it worked before, so I wouldn't undervalue it, especially in terms of 3.0.0 migration |
Ha yeah makes me wonder, is |
I think, no :-) What makes you assume this? |
This change can be tested using mobx@2.7.0-beta |
Closing this issue as mobx@3.0.0-rc.1 is now available, which addresses this issue. Changelog: https://github.com/mobxjs/mobx/blob/mobx3/CHANGELOG.md#300. The changes in more details: https://github.com/mobxjs/mobx/pull/725/files. Feel free to re-open if questions arise! |
@mweststrate It is very pleasure to hear that mobx 3.0 will be out. I was taken to this thread by use
I just try to install I also find the change log of 2.7.0, but still confused how to use with decorator(could you explain how to upgrade the example below? Example from the official doc): class Timer {
@observable start = Date.now();
@observable current = Date.now();
@computed get elapsedTime() {
return (this.current - this.start) + "seconds"
}
@action tick() {
this.current = Date.now()
}
} maybe create the new series of egghead videos will be great 😁 |
Anyone help upgrade this code?
I tried this but then it does not get called correctly:
|
@HaveF @indivisable be aware of commenting on closed issues, comments are easily missed :) @HaveF your example is valid in both MobX 2 & 3 @indivisable |
@mweststrate Thanks! By simply removing the observable seemed to do the trick.
|
thanks @mweststrate |
See #421. Breaking change so for next major
For migration purposes MobX should warn in a next minor if an function is passed without marking it either with
asReference
,computed
orget
The text was updated successfully, but these errors were encountered: