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

[Deprecation] renderTemplate and disconnectOutlet methods #19388

Closed
Closed
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
Expand Up @@ -4,6 +4,7 @@ import {
moduleFor,
strip,
} from 'internal-test-helpers';
// import { ExpectDeprecationFunc } from '../../../../../../internal-test-helpers/lib/ember-dev/deprecation';

import { ENV } from '@ember/-internals/environment';
import { Component, setComponentManager } from '@ember/-internals/glimmer';
Expand Down Expand Up @@ -180,6 +181,10 @@ if (ENV._DEBUG_RENDER_TREE) {
}

async '@test named outlets'() {
// TODO - fix this type error
// @ts-ignore-next-line
expectDeprecation(() => {}, 'The usage of `disconnectOutlet` is deprecated.');

this.addTemplate(
'application',
strip`
Expand Down
9 changes: 9 additions & 0 deletions packages/@ember/-internals/routing/lib/system/route.ts
Expand Up @@ -1705,6 +1705,15 @@ class Route extends EmberObject implements IRoute {
@public
*/
disconnectOutlet(options: string | { outlet: string; parentView?: string }) {
deprecate('The usage of `disconnectOutlet` is deprecated.', false, {
id: 'router-render-methods.disconnect-outlet',
until: '4.0.0',
url: 'TODO',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be auto-deployed shortly, so you can grab the URL

for: 'ember-source',
since: {
enabled: '3.26.0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
enabled: '3.26.0',
enabled: '3.27.0',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwjblue so isn't the current beta cycle 3.26 when we'd expect this to land?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, beta has already branched away from master. This happens 6 weeks before the beta is released. During those 6 weeks, when we land features on master, they are not by default included in beta - they are targeting the release after beta (e.g. canary).

We can, and sometimes do, patch them into the beta branch (e.g. for bugfixes). For features and deprecations, we approach it on a case-by-case basis, but we tend to avoid it unless there is a good reason and it's not a high risk change. In this case, I think it's reasonable to not backport, so we would be targeting master, which is currently 3.27.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to break the disconnectOutlet deprecation out into #19407. The render and renderTemplate deprecations are taking longer than I expected (lots of tests to fix).

},
});
let outletName;
let parentView;
if (options) {
Expand Down
15 changes: 14 additions & 1 deletion packages/ember/tests/routing/template_rendering_test.js
Expand Up @@ -752,6 +752,8 @@ moduleFor(
}

['@test Route supports clearing outlet explicitly'](assert) {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
this.addTemplate('posts', '{{outlet}}');
this.addTemplate('users', 'users');
Expand Down Expand Up @@ -876,6 +878,7 @@ moduleFor(
}

['@test Route supports clearing outlet using string parameter'](assert) {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');
this.addTemplate('application', "{{outlet}}{{outlet 'modal'}}");
this.addTemplate('posts', '{{outlet}}');
this.addTemplate('users', 'users');
Expand Down Expand Up @@ -942,7 +945,9 @@ moduleFor(
}

['@test Route silently fails when cleaning an outlet from an inactive view'](assert) {
assert.expect(1); // handleURL
assert.expect(2); // handleURL

expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.addTemplate('application', '{{outlet}}');
this.addTemplate('posts', "{{outlet 'modal'}}");
Expand Down Expand Up @@ -1062,6 +1067,8 @@ moduleFor(
}

['@test Can disconnect a named outlet at the top level'](assert) {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.addTemplate('application', 'A-{{outlet}}-B-{{outlet "other"}}-C');
this.addTemplate('modal', 'Hello world');
this.addTemplate('index', 'The index');
Expand Down Expand Up @@ -1232,6 +1239,8 @@ moduleFor(
}

['@test Tolerates stacked renders'](assert) {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
this.addTemplate('index', 'hi');
this.addTemplate('layer', 'layer');
Expand Down Expand Up @@ -1305,6 +1314,8 @@ moduleFor(
}

["@test Allows any route to disconnectOutlet another route's templates"](assert) {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.addTemplate('application', '{{outlet}}{{outlet "modal"}}');
this.addTemplate('index', 'hi');
this.addTemplate('layer', 'layer');
Expand Down Expand Up @@ -1427,6 +1438,8 @@ moduleFor(
}

['@test Exception if outlet name is undefined in render and disconnectOutlet']() {
expectDeprecation('The usage of `disconnectOutlet` is deprecated.');

this.add(
'route:application',
Route.extend({
Expand Down