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

Bug with templatizer since Polymer 2.5 #5105

Closed
RoXuS opened this issue Feb 8, 2018 · 2 comments
Closed

Bug with templatizer since Polymer 2.5 #5105

RoXuS opened this issue Feb 8, 2018 · 2 comments

Comments

@RoXuS
Copy link

RoXuS commented Feb 8, 2018

Hello @kevinpschaaf,

We have a bug since the 2.5 release and in particular with this commit: bde5898. (related to #4458)

Now, when we have a property in the template of the element which have a templatizer, it doesn't work.

You can see a live demo:

http://jsbin.com/kafopovoqo/1/edit?html,console,output
prop2 is never displayed, if you rollback to the 2.4 it is ok.

@kevinpschaaf
Copy link
Member

The intention has always been that options.forwardHostProp was required to be specified in order for host properties (e.g. prop2) to be forwarded to templatizer instances. There was a bug of sorts pre 2.5, however, in that host props were always pulled from the host and set on instances at instance creation time only; however, if the host properties change after the fact, they would not be forwarded (see your jsBin modified to actually modify prop2: http://jsbin.com/kubejog/edit?html,console,output). So while you were seeing prop2 forwarded in once, this was a bit of a fluke since it wouldn't stay in sync.

Since this is a bit of a footgun, this was normalized in #5035, such that host property forwarding is only done when options.forwardHostProp is specified, since the docs only mention host prop forwarding in the context of specifying this option. I've updated your jsBin to add a forwardHostProp function (it is called _forwardHostPropV2 when using the legacy Templatizer behavior API in 2.x): http://jsbin.com/sedofid/1/edit?html,console,output

I also updated your code to use the templatizer library syntax, which is a bit cleaner (once you're using non-hybrid Polymer.Element, there is no need to use the legacy behavior): http://jsbin.com/ximowuc/edit?html,console,output

Let me know if you're ok with this change. It's sort of in a gray area of breaking-vs-bugfix, since the intention has always been that forwardHostProp was required, but you were obviously relying on the existing (undocumented) behavior. Thanks.

@RoXuS
Copy link
Author

RoXuS commented Feb 8, 2018

@kevinpschaaf, it's super clear, thx for your reactivity ! !

@RoXuS RoXuS closed this as completed Feb 8, 2018
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

3 participants