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

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

Merged
merged 3 commits into from Apr 13, 2019

Conversation

kevinpschaaf
Copy link
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.

@@ -364,7 +364,7 @@ function createTemplatizerClass(template, templateInfo, options) {
*/
function addPropagateEffects(template, templateInfo, options) {
let userForwardHostProp = options.forwardHostProp;
if (userForwardHostProp) {
if (userForwardHostProp && templateInfo.hasHostProps) {
Copy link
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.

None yet

3 participants