From b659e2307d547388c961f3480a5c8699f4185b16 Mon Sep 17 00:00:00 2001 From: Chris Garrett Date: Thu, 8 Aug 2019 14:45:21 -0700 Subject: [PATCH] [BUGFIX] Adds Component Manager 3.13 Capabilities Adds 3.13 component manager capabilities, which adds the ability to enable/disable the `updateHook` for a component. --- .../glimmer/lib/component-managers/custom.ts | 14 +++++++++++--- .../glimmer/tests/utils/glimmerish-component.js | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts b/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts index 37eb3633b55..64d36b33c40 100644 --- a/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts +++ b/packages/@ember/-internals/glimmer/lib/component-managers/custom.ts @@ -47,13 +47,21 @@ export interface OptionalCapabilities { updateHook?: boolean; } -export function capabilities(managerAPI: '3.4', options: OptionalCapabilities = {}): Capabilities { - assert('Invalid component manager compatibility specified', managerAPI === '3.4'); +type managerAPIVersion = '3.4' | '3.13'; + +export function capabilities( + managerAPI: managerAPIVersion, + options: OptionalCapabilities = {} +): Capabilities { + assert( + 'Invalid component manager compatibility specified', + managerAPI === '3.4' || managerAPI === '3.13' + ); let updateHook = true; if (EMBER_CUSTOM_COMPONENT_ARG_PROXY) { - updateHook = 'updateHook' in options ? Boolean(options.updateHook) : true; + updateHook = managerAPI === '3.13' ? Boolean(options.updateHook) : true; } return { diff --git a/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js b/packages/@ember/-internals/glimmer/tests/utils/glimmerish-component.js index db3e12fce70..26f11211a5d 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', { updateHook: false }); + this.capabilities = capabilities('3.13', { updateHook: false }); this.owner = owner; }