From: skirtle <65301168+skirtles-code@users.noreply.github.com> Date: Mon, 24 Nov 2025 06:38:03 +0000 (+0000) Subject: refactor(runtime-core): check `props` rather than `propsOptions[0]` (#13514) X-Git-Tag: v3.5.25~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5af3dd9b4546252222bb2e4d80499ba37cead03b;p=thirdparty%2Fvuejs%2Fcore.git refactor(runtime-core): check `props` rather than `propsOptions[0]` (#13514) --- diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index 57d784c0e0..a334b487df 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) { @@ -455,12 +454,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { ) { 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)) { @@ -583,11 +577,11 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { has( { - _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }, + _: { data, setupState, accessCache, ctx, appContext, props, type }, }: ComponentRenderContext, key: string, ) { - let normalizedProps, cssModules + let cssModules return !!( accessCache![key] || (__FEATURE_OPTIONS_API__ && @@ -595,7 +589,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler = { key[0] !== '$' && 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) ||