Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove string-based setComponentManager #19656

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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