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

Computed property can't be data-bound from outside #638

Closed
arthurevans opened this issue Jul 16, 2014 · 12 comments · Fixed by googlearchive/polymer-dev#88
Closed

Computed property can't be data-bound from outside #638

arthurevans opened this issue Jul 16, 2014 · 12 comments · Fixed by googlearchive/polymer-dev#88
Assignees

Comments

@arthurevans
Copy link

When using a computed property, I can data bind it inside the element's template. However, it doesn't appear to be published such that an outside element can bind to it.

Test case:
http://jsbin.com/jifon/3/edit

The binding inside the element's template shows up. However, binding to it in the auto-binding template doesn't work. (Filtered value never appears.)

This seems wrong -- @rafaelw?

@sorvell
Copy link
Contributor

sorvell commented Jul 16, 2014

I think we need to make this work, but it'll require some more sophistication in the binding system.

Right now a computed property is essentially 'bound' to the computation of its value.

@arthurevans
Copy link
Author

Hm. Funny that it works correctly inside the element, though.

Given that this is a big gotcha, I'm inclined to put off documenting computed properties until it works, unless you folks feel otherwise -- @sorvell @sjmiles, I'm lookin' at you ;-).

@sorvell
Copy link
Contributor

sorvell commented Jul 17, 2014

I suggest documenting how it works now. I think we can call this out as a
limitation that will be addressed soon.

On Wed, Jul 16, 2014 at 5:29 PM, Arthur Evans notifications@github.com
wrote:

Hm. Funny that it works correctly inside the element, though.

Given that this is a big gotcha, I'm inclined to put off documenting
computed properties until it works, unless you folks feel otherwise --
@sorvell https://github.com/sorvell @sjmiles
https://github.com/sjmiles, I'm lookin' at you ;-).


Reply to this email directly or view it on GitHub
#638 (comment).

@ebidel
Copy link
Contributor

ebidel commented Jul 17, 2014

I think we should definitely document it now. Many people have asked about
computed properties.
On Jul 16, 2014 5:38 PM, "Steve Orvell" notifications@github.com wrote:

I suggest documenting how it works now. I think we can call this out as a
limitation that will be addressed soon.

On Wed, Jul 16, 2014 at 5:29 PM, Arthur Evans notifications@github.com
wrote:

Hm. Funny that it works correctly inside the element, though.

Given that this is a big gotcha, I'm inclined to put off documenting
computed properties until it works, unless you folks feel otherwise --
@sorvell https://github.com/sorvell @sjmiles
https://github.com/sjmiles, I'm lookin' at you ;-).


Reply to this email directly or view it on GitHub
#638 (comment).


Reply to this email directly or view it on GitHub
#638 (comment).

@jmesserly jmesserly self-assigned this Jul 17, 2014
@jmesserly
Copy link
Contributor

@sorvell just got me up to speed on this. I can take a look.

The issue is that computed properties are treated as a property binding (bindToAccessor) so they collide:
https://github.com/Polymer/polymer-dev/blob/master/src/instance/properties.js#L193

@rafaelw
Copy link
Contributor

rafaelw commented Aug 14, 2014

John, I actually prepared a patch for this prior to I/O, but the team didn't want any more changes while they were trying to stabilize:

https://codereview.appspot.com/102290043/.

If you want to take over this patch, I doubt landing it will be very hard.

@jmesserly
Copy link
Contributor

oh, awesome! Thanks for sending that my way!

@jmesserly
Copy link
Contributor

... and if you wanted to land it that works for me too :). But in case it requires merging I'm happy to revive it!

@arthurevans
Copy link
Author

<happy-dance> !!! </happy-dance>

@jmesserly
Copy link
Contributor

hmmm. I'm a little confused, but your original jsbin still seems to be failing even after the fix.
@arthurevans do you see that too? maybe I'm seeing an old cached copy, but polymer.js and platform.js both claim to be 0.4.1 ...

Maybe it's an issue with how the fix interacts with auto-binding. Just a guess because that's one difference between your jsbin compared to the test that was added.

@jmesserly
Copy link
Contributor

Ah, nevermind, it looks like there was an (unrelated) change where computed properties are not considered "published" automatically. If I add "reversedvalue" to attributes= it works: http://jsbin.com/curiwocomopa/1/edit

@arthurevans
Copy link
Author

Ah, yeah. I documented it that way: http://www.polymer-project.org/docs/polymer/polymer.html#computed-properties

One extra step, but it seems reasonable that you might not want to publish every computed property.

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

Successfully merging a pull request may close this issue.

5 participants