From 65a5b48c38be5866a9e9d2e450218ed7f739aadc Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 10 Apr 2019 14:47:39 -0700 Subject: [PATCH] Avoid upgrading template if no hostProps, for better perf. --- lib/utils/templatize.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/utils/templatize.js b/lib/utils/templatize.js index 9f05135470..7cdcb8ca4a 100644 --- a/lib/utils/templatize.js +++ b/lib/utils/templatize.js @@ -364,7 +364,11 @@ function createTemplatizerClass(template, templateInfo, options) { */ function addPropagateEffects(template, templateInfo, options) { let userForwardHostProp = options.forwardHostProp; - if (userForwardHostProp) { + const hasHostProps = templateInfo.hasHostProps || + (templateInfo.hasHostProps = + Boolean(templateInfo.hostProps && + Object.keys(templateInfo.hostProps).length)); + if (userForwardHostProp && hasHostProps) { // Provide data API and property effects on memoized template class let klass = templateInfo.templatizeTemplateClass; if (!klass) {