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

it should be possible to redefine a computed property #1121

Closed
mweststrate opened this issue Aug 5, 2017 · 2 comments
Closed

it should be possible to redefine a computed property #1121

mweststrate opened this issue Aug 5, 2017 · 2 comments

Comments

@mweststrate
Copy link
Member

mweststrate commented Aug 5, 2017

Example;

const a = observable({
  width: 10, 
  get surface() { return this.width }
})

observe(a, "surface", v => console.log(v))
reaction(() => a.surface, v => console.log(v))

extendObservable(a, {
  get surface() { return this.width * 2 }
})

Should no longer throw but work as expected.

Downside: there might be issues with lingering low-level subscriptions, the above observe based logger will keep listing to the 'old' definition (which is the reason it is now forbidden). Normal property access like the reaction should work correctly. Potential confusion about the difference is the reason it has not been supported so far

koretskiyav added a commit to koretskiyav/mobx that referenced this issue Aug 23, 2017
koretskiyav added a commit to koretskiyav/mobx that referenced this issue Sep 13, 2017
mweststrate added a commit that referenced this issue Sep 18, 2017
…ted_property

#1121 add possibility to redefine a computed property #GoodnessSquadKyiv
@mweststrate
Copy link
Member Author

Fixed through #1151, will be part of next release

@mweststrate
Copy link
Member Author

Fixed as part of 3.3.0

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

No branches or pull requests

2 participants