diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts b/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts index 69567b7be81..d0c97ab1f22 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts @@ -45,14 +45,22 @@ const CAPABILITIES = { export interface OptionalCapabilities { asyncLifecycleCallbacks?: boolean; destructor?: boolean; + updateHook?: boolean; } export function capabilities(managerAPI: '3.4', options: OptionalCapabilities = {}): Capabilities { assert('Invalid component manager compatibility specified', managerAPI === '3.4'); + let updateHook = true; + + if (EMBER_CUSTOM_COMPONENT_ARG_PROXY) { + updateHook = updateHook: 'updateHook' in options ? Boolean(options.updateHook) : true; + } + return { asyncLifeCycleCallbacks: Boolean(options.asyncLifecycleCallbacks), destructor: Boolean(options.destructor), + updateHook, }; } @@ -66,6 +74,7 @@ export interface DefinitionState { export interface Capabilities { asyncLifeCycleCallbacks: boolean; destructor: boolean; + updateHook: boolean; } // TODO: export ICapturedArgumentsValue from glimmer and replace this @@ -137,12 +146,12 @@ export interface ComponentArguments { export default class CustomComponentManager extends AbstractComponentManager< CustomComponentState, - DefinitionState + CustomComponentDefinitionState > implements WithStaticLayout< CustomComponentState, - DefinitionState, + CustomComponentDefinitionState, OwnedTemplateMeta, RuntimeResolver > { @@ -265,8 +274,12 @@ export default class CustomComponentManager } } - getCapabilities(): ComponentCapabilities { - return CAPABILITIES; + getCapabilities({ + delegate, + }: CustomComponentDefinitionState): ComponentCapabilities { + return Object.assign({}, CAPABILITIES, { + updateHook: delegate.capabilities.updateHook, + }); } getTag({ args }: CustomComponentState): Tag { diff --git a/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js b/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js index ce3b8003524..db3e12fce70 100644 --- a/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js +++ b/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js @@ -3,7 +3,7 @@ import { setOwner } from '@ember/-internals/owner'; class GlimmerishComponentManager { constructor(owner) { - this.capabilities = capabilities('3.4'); + this.capabilities = capabilities('3.4', { updateHook: false }); this.owner = owner; } @@ -11,8 +11,6 @@ class GlimmerishComponentManager { return new Factory(this.owner, args.named); } - updateComponent() {} - getContext(component) { return component; }