Skip to content

Avoid upgrading template if no hostProps, for better perf. - #5520

Merged
kevinpschaaf merged 3 commits into
masterfrom
avoid-template-upgrade
Apr 13, 2019
Merged

Avoid upgrading template if no hostProps, for better perf.#5520
kevinpschaaf merged 3 commits into
masterfrom
avoid-template-upgrade

Conversation

@kevinpschaaf

Copy link
Copy Markdown
Member

When e.g. a dom-repeat only binds to local instance properties (like item or index), it is unnecessary to "upgrade" the associated <template> as a PropertyEffects client, since there will be no host properties to forward to it. This condition can be detected based on the count of host properties in the template.

Comment thread lib/utils/templatize.js
function addPropagateEffects(template, templateInfo, options) {
let userForwardHostProp = options.forwardHostProp;
if (userForwardHostProp) {
if (userForwardHostProp && templateInfo.hasHostProps) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment here or perhaps just in the doc for the function explaining what this does so it's clear why it's only related to hostProps.

@kevinpschaaf
kevinpschaaf merged commit 8f4cc31 into master Apr 13, 2019
@kevinpschaaf
kevinpschaaf deleted the avoid-template-upgrade branch April 13, 2019 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants