]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: enable private vnode properties even for built-ins
authorEvan You <yyx990803@gmail.com>
Tue, 4 May 2021 22:20:14 +0000 (18:20 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 4 May 2021 22:26:28 +0000 (18:26 -0400)
packages/runtime-core/src/compat/compatConfig.ts
packages/runtime-core/src/compat/renderFn.ts

index d715d97040f8f6f022f4f382002394bf4d34f9ab..cbff8c785636f9a55b827591fd997d212b7a24bd 100644 (file)
@@ -566,10 +566,11 @@ export function getCompatConfigForKey(
 
 export function isCompatEnabled(
   key: DeprecationTypes,
-  instance: ComponentInternalInstance | null
+  instance: ComponentInternalInstance | null,
+  enableForBuiltIn = false
 ): boolean {
   // skip compat for built-in components
-  if (instance && instance.type.__isBuiltIn) {
+  if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
     return false
   }
 
index ba67cd36636de4a8e495bac8a39c454bb6218869..af8e78a3379596cb93831e82c931d2b475736300 100644 (file)
@@ -307,16 +307,21 @@ export function defineLegacyVNodeProperties(vnode: VNode) {
   if (
     isCompatEnabled(
       DeprecationTypes.RENDER_FUNCTION,
-      currentRenderingInstance
+      currentRenderingInstance,
+      true /* enable for built-ins */
     ) &&
-    isCompatEnabled(DeprecationTypes.PRIVATE_APIS, currentRenderingInstance)
+    isCompatEnabled(
+      DeprecationTypes.PRIVATE_APIS,
+      currentRenderingInstance,
+      true /* enable for built-ins */
+    )
   ) {
     const context = currentRenderingInstance
     const getInstance = () => vnode.component && vnode.component.proxy
     let componentOptions: any
     Object.defineProperties(vnode, {
       tag: { get: () => vnode.type },
-      data: { get: () => vnode.props, set: p => (vnode.props = p) },
+      data: { get: () => vnode.props || {}, set: p => (vnode.props = p) },
       elm: { get: () => vnode.el },
       componentInstance: { get: getInstance },
       child: { get: getInstance },