Skip to content

Commit 7e6a76e

Browse files
committed
wip: enable private vnode properties even for built-ins
1 parent ae0fb14 commit 7e6a76e

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/runtime-core/src/compat/compatConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,11 @@ export function getCompatConfigForKey(
566566

567567
export function isCompatEnabled(
568568
key: DeprecationTypes,
569-
instance: ComponentInternalInstance | null
569+
instance: ComponentInternalInstance | null,
570+
enableForBuiltIn = false
570571
): boolean {
571572
// skip compat for built-in components
572-
if (instance && instance.type.__isBuiltIn) {
573+
if (!enableForBuiltIn && instance && instance.type.__isBuiltIn) {
573574
return false
574575
}
575576

packages/runtime-core/src/compat/renderFn.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,21 @@ export function defineLegacyVNodeProperties(vnode: VNode) {
307307
if (
308308
isCompatEnabled(
309309
DeprecationTypes.RENDER_FUNCTION,
310-
currentRenderingInstance
310+
currentRenderingInstance,
311+
true /* enable for built-ins */
311312
) &&
312-
isCompatEnabled(DeprecationTypes.PRIVATE_APIS, currentRenderingInstance)
313+
isCompatEnabled(
314+
DeprecationTypes.PRIVATE_APIS,
315+
currentRenderingInstance,
316+
true /* enable for built-ins */
317+
)
313318
) {
314319
const context = currentRenderingInstance
315320
const getInstance = () => vnode.component && vnode.component.proxy
316321
let componentOptions: any
317322
Object.defineProperties(vnode, {
318323
tag: { get: () => vnode.type },
319-
data: { get: () => vnode.props, set: p => (vnode.props = p) },
324+
data: { get: () => vnode.props || {}, set: p => (vnode.props = p) },
320325
elm: { get: () => vnode.el },
321326
componentInstance: { get: getInstance },
322327
child: { get: getInstance },

0 commit comments

Comments
 (0)