diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index e9e7770ebd9..0f4eb3d2b0a 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -430,7 +430,6 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { // is the multiple hasOwn() calls. It's much faster to do a simple property // access on a plain object, so we use an accessCache object (with null // prototype) to memoize what access type a key corresponds to. - let normalizedProps if (key[0] !== '$') { const n = accessCache![key] if (n !== undefined) { @@ -451,12 +450,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { } else if (data !== EMPTY_OBJ && hasOwn(data, key)) { accessCache![key] = AccessTypes.DATA return data[key] - } else if ( - // only cache other properties when instance has declared (thus stable) - // props - (normalizedProps = instance.propsOptions[0]) && - hasOwn(normalizedProps, key) - ) { + } else if (hasOwn(props, key)) { accessCache![key] = AccessTypes.PROPS return props![key] } else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { @@ -575,16 +569,15 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { has( { - _: { data, setupState, accessCache, ctx, appContext, propsOptions }, + _: { data, setupState, accessCache, ctx, appContext, props }, }: ComponentRenderContext, key: string, ) { - let normalizedProps return ( !!accessCache![key] || (data !== EMPTY_OBJ && hasOwn(data, key)) || hasSetupBinding(setupState, key) || - ((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) || + hasOwn(props, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key)