Skip to content

Commit 7694ed0

Browse files
authored
Merge pull request #20578 from emberjs/beta-deprecate-outlet-template-factory
[BUGFIX beta] Deprecate outlet `TemplateFactory` support
2 parents 72ca377 + f5a1cb9 commit 7694ed0

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

packages/@ember/-internals/glimmer/lib/syntax/outlet.ts

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { InternalOwner } from '@ember/-internals/owner';
2-
import { assert } from '@ember/debug';
2+
import { assert, deprecate } from '@ember/debug';
33
import { DEBUG } from '@glimmer/env';
44
import type { CapturedArguments, DynamicScope } from '@glimmer/interfaces';
55
import { CurriedType } from '@glimmer/interfaces';
@@ -124,6 +124,36 @@ function stateFor(ref: Reference, outlet: OutletState | undefined): OutletDefini
124124
// and is no longer considered supported
125125
if (isTemplateFactory(template)) {
126126
template = template(render.owner);
127+
128+
if (DEBUG) {
129+
let message =
130+
'The `template` property of `OutletState` should be a ' +
131+
'`Template` rather than a `TemplateFactory`. This is known to be a ' +
132+
"problem in older versions of `@ember/test-helpers`. If you haven't " +
133+
'done so already, try upgrading to the latest version.\n\n';
134+
135+
if (template.result === 'ok' && typeof template.moduleName === 'string') {
136+
message +=
137+
'The offending template has a moduleName `' +
138+
template.moduleName +
139+
'`, which might be helpful for identifying ' +
140+
'source of this issue.\n\n';
141+
}
142+
143+
message +=
144+
'Please note that `OutletState` is a private API in Ember.js ' +
145+
"and not meant to be used outside of the framework's internal code.";
146+
147+
deprecate(message, false, {
148+
id: 'outlet-state-template-factory',
149+
until: '5.9.0',
150+
for: 'ember-source',
151+
since: {
152+
available: '5.5.0',
153+
enabled: '5.5.0',
154+
},
155+
});
156+
}
127157
}
128158

129159
return {

packages/ember/tests/ember-test-helpers-test.js

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ module('@ember/test-helpers emulation test', function () {
110110

111111
module('setupRenderingContext', function (hooks) {
112112
hooks.beforeEach(async function () {
113+
expectDeprecation(
114+
/The `template` property of `OutletState` should be a `Template` rather than a `TemplateFactory`/
115+
);
116+
113117
this.application = Application.create({
114118
rootElement: '#qunit-fixture',
115119
autoboot: false,

0 commit comments

Comments
 (0)