Skip to content

Commit 072b35f

Browse files
committed
fix: only set inheritAttrs from mixin if component self does not have
the option
1 parent 1243c97 commit 072b35f

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

packages/runtime-core/src/componentOptions.ts

+21-17
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,6 @@ export function applyOptions(
564564
const ctx = instance.ctx
565565
const globalMixins = instance.appContext.mixins
566566

567-
if (asMixin && render && instance.render === NOOP) {
568-
instance.render = render as InternalRenderFunction
569-
}
570-
571567
// applyOptions is called non-as-mixin once per instance
572568
if (!asMixin) {
573569
shouldCacheAccess = false
@@ -745,19 +741,6 @@ export function applyOptions(
745741
})
746742
}
747743

748-
// asset options.
749-
// To reduce memory usage, only components with mixins or extends will have
750-
// resolved asset registry attached to instance.
751-
if (asMixin) {
752-
resolveInstanceAssets(instance, options, COMPONENTS)
753-
resolveInstanceAssets(instance, options, DIRECTIVES)
754-
if (__COMPAT__ && isCompatEnabled(DeprecationTypes.FILTERS, instance)) {
755-
resolveInstanceAssets(instance, options, FILTERS)
756-
}
757-
758-
if (inheritAttrs !== undefined) instance.inheritAttrs = inheritAttrs
759-
}
760-
761744
// lifecycle options
762745
if (!asMixin) {
763746
callSyncHook(
@@ -831,6 +814,27 @@ export function applyOptions(
831814
warn(`The \`expose\` option is ignored when used in mixins.`)
832815
}
833816
}
817+
818+
// options that are handled when creating the instance but also need to be
819+
// applied from mixins
820+
if (asMixin) {
821+
if (render && instance.render === NOOP) {
822+
instance.render = render as InternalRenderFunction
823+
}
824+
825+
if (inheritAttrs != null && instance.type.inheritAttrs == null) {
826+
instance.inheritAttrs = inheritAttrs
827+
}
828+
829+
// asset options.
830+
// To reduce memory usage, only components with mixins or extends will have
831+
// resolved asset registry attached to instance.
832+
resolveInstanceAssets(instance, options, COMPONENTS)
833+
resolveInstanceAssets(instance, options, DIRECTIVES)
834+
if (__COMPAT__ && isCompatEnabled(DeprecationTypes.FILTERS, instance)) {
835+
resolveInstanceAssets(instance, options, FILTERS)
836+
}
837+
}
834838
}
835839

836840
function resolveInstanceAssets(

0 commit comments

Comments
 (0)