Browse Source

fix: fix not saving cached computed options

Evan You 7 years ago
parent
commit
871947c25f
2 changed files with 6 additions and 1 deletions
  1. 1 0
      packages/core/src/componentComputed.ts
  2. 5 1
      packages/core/src/componentUtils.ts

+ 1 - 0
packages/core/src/componentComputed.ts

@@ -25,6 +25,7 @@ export function getComputedOptions(
       // as it's already defined on the prototype
       // as it's already defined on the prototype
     }
     }
   }
   }
+  extractionCache.set(comp, computedOptions)
   return computedOptions
   return computedOptions
 }
 }
 
 

+ 5 - 1
packages/core/src/componentUtils.ts

@@ -110,7 +110,11 @@ export function normalizeComponentRoot(
       componentVNode &&
       componentVNode &&
       (flags & VNodeFlags.COMPONENT || flags & VNodeFlags.ELEMENT)
       (flags & VNodeFlags.COMPONENT || flags & VNodeFlags.ELEMENT)
     ) {
     ) {
-      if (inheritAttrs !== false && attrs !== void 0) {
+      if (
+        inheritAttrs !== false &&
+        attrs !== void 0 &&
+        Object.keys(attrs).length > 0
+      ) {
         vnode = cloneVNode(vnode, attrs)
         vnode = cloneVNode(vnode, attrs)
       } else if (vnode.el) {
       } else if (vnode.el) {
         vnode = cloneVNode(vnode)
         vnode = cloneVNode(vnode)