Skip to content

Commit

Permalink
Remove string-based setComponentManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Jul 18, 2021
1 parent 9149433 commit bd7d710
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
28 changes: 2 additions & 26 deletions packages/@ember/-internals/glimmer/lib/utils/managers.ts
@@ -1,6 +1,5 @@
import { Owner } from '@ember/-internals/owner';
import { deprecate } from '@ember/debug';
import { COMPONENT_MANAGER_STRING_LOOKUP } from '@ember/deprecated-features';
import { DEBUG } from '@glimmer/env';
import { ComponentManager } from '@glimmer/interfaces';
import {
Expand All @@ -10,33 +9,10 @@ import {
} from '@glimmer/manager';

export function setComponentManager(
stringOrFunction: string | ((owner: Owner) => ComponentManager<unknown>),
manager: ((owner: Owner) => ComponentManager<unknown>),
obj: object
): object {
let factory: (owner: Owner) => ComponentManager<unknown>;

if (COMPONENT_MANAGER_STRING_LOOKUP && typeof stringOrFunction === 'string') {
deprecate(
'Passing the name of the component manager to "setupComponentManager" is deprecated. Please pass a function that produces an instance of the manager.',
false,
{
id: 'deprecate-string-based-component-manager',
until: '4.0.0',
url: 'https://deprecations.emberjs.com/v3.x/#toc_component-manager-string-lookup',
for: 'ember-source',
since: {
enabled: '3.8.0',
},
}
);
factory = function (owner: Owner) {
return owner.lookup<ComponentManager<unknown>>(`component-manager:${stringOrFunction}`)!;
};
} else {
factory = stringOrFunction as (owner: Owner) => ComponentManager<unknown>;
}

return glimmerSetComponentManager(factory, obj);
return glimmerSetComponentManager(manager, obj);
}

export let componentCapabilities = glimmerComponentCapabilities;
Expand Down
Expand Up @@ -80,17 +80,6 @@ class ComponentManagerTest extends RenderingTestCase {
moduleFor(
'Component Manager - Curly Invocation',
class extends ComponentManagerTest {
['@test the string based version of setComponentManager is deprecated']() {
expectDeprecation(() => {
setComponentManager(
'basic',
EmberObject.extend({
greeting: 'hello',
})
);
}, 'Passing the name of the component manager to "setupComponentManager" is deprecated. Please pass a function that produces an instance of the manager.');
}

['@test it can render a basic component with custom component manager']() {
let ComponentClass = setComponentManager(
createBasicManager,
Expand Down
1 change: 0 additions & 1 deletion packages/@ember/deprecated-features/index.ts
Expand Up @@ -6,7 +6,6 @@
export const SEND_ACTION = !!'3.4.0';
export const EMBER_EXTEND_PROTOTYPES = !!'3.2.0-beta.5';
export const ROUTER_EVENTS = !!'4.0.0';
export const COMPONENT_MANAGER_STRING_LOOKUP = !!'3.8.0';
export const JQUERY_INTEGRATION = !!'3.9.0';
export const APP_CTRL_ROUTER_PROPS = !!'3.10.0-beta.1';
export const FUNCTION_PROTOTYPE_EXTENSIONS = !!'3.11.0-beta.1';
Expand Down

0 comments on commit bd7d710

Please sign in to comment.