Open montyr75 opened 8 years ago
I think the real problem is that polymer
forbid to explicitly notify a computed property. Annotating it with @observe
will throw because autonotify
will try to do that.
In your example the same happens if you try call a notifyPath('userMessage','something')
(infact what it is supposed to be passed as a value argument if the value is computed?).
Removing the @observe
annotation will make everything work as expected even if user
and isHappy
are normal properties annotated with @observe
.
I'll close the issue, reopen it if you don't agree.
I think this issue is not solved. If you want the computed property to be @observable
fires an V8 Exception
Example code:
@observable @property num width;
@observable @property num heigth;
@observable @Property(computed: 'computeArea(width, height)') num area;
@reflectable
num computeArea(width, heigth) => width * height;
A possible work around is:
@observable @property num width;
@observable @property num heigth;
@observable @property num area;
@Observe(width, height)
num computeArea(width, heigth) => area = width * height;
Hi,
I was considering patching the transformer to ignore the @observable
annotation on computed
properties.
Infact polymer will automatically notify
computed properties everytimes they are recalculated, so there isn't actually any need for "observing" them.
Do you think this solution could be acceptable ?
I think yes
When doing something like this:
computeUserMessage()
does run, but then an unhandled exception is thrown. Something like'undefined' is not a function