Skip to content

Commit 68fb26d

Browse files
committed
refactor(runtime-core): check feature flag when forwarding data properties
1 parent c16f8a9 commit 68fb26d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
448448
} else if (hasSetupBinding(setupState, key)) {
449449
accessCache![key] = AccessTypes.SETUP
450450
return setupState[key]
451-
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
451+
} else if (
452+
__FEATURE_OPTIONS_API__ &&
453+
data !== EMPTY_OBJ &&
454+
hasOwn(data, key)
455+
) {
452456
accessCache![key] = AccessTypes.DATA
453457
return data[key]
454458
} else if (
@@ -545,7 +549,11 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
545549
) {
546550
warn(`Cannot mutate <script setup> binding "${key}" from Options API.`)
547551
return false
548-
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
552+
} else if (
553+
__FEATURE_OPTIONS_API__ &&
554+
data !== EMPTY_OBJ &&
555+
hasOwn(data, key)
556+
) {
549557
data[key] = value
550558
return true
551559
} else if (hasOwn(instance.props, key)) {
@@ -582,7 +590,10 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
582590
let normalizedProps, cssModules
583591
return !!(
584592
accessCache![key] ||
585-
(data !== EMPTY_OBJ && key[0] !== '$' && hasOwn(data, key)) ||
593+
(__FEATURE_OPTIONS_API__ &&
594+
data !== EMPTY_OBJ &&
595+
key[0] !== '$' &&
596+
hasOwn(data, key)) ||
586597
hasSetupBinding(setupState, key) ||
587598
((normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key)) ||
588599
hasOwn(ctx, key) ||

0 commit comments

Comments
 (0)