-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[CLEANUP] Remove all traces of named outlets code #20570
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,41 @@ | ||
import type { InternalOwner } from '@ember/-internals/owner'; | ||
import type { Template, TemplateFactory } from '@glimmer/interfaces'; | ||
import type { Template } from '@glimmer/interfaces'; | ||
|
||
// Note: a lot of these does not make sense anymore. This design was from back | ||
// when we supported "named outlets", where a route can do: | ||
// | ||
// this.renderTemplate("some-template", { | ||
// into: 'some-parent-route', | ||
// outlet: 'some-name' /* {{outlet "some-name"}} */ | undefined /* {{outlet}} */, | ||
// controller: 'some-controller' | SomeController, | ||
// model: { ... }, | ||
// }); | ||
// | ||
// And interface reflects that. Now that this is not supported anymore, each | ||
// route implicitly renders into its immediate parent's `{{outlet}}` (no name). | ||
// Keeping around most of these to their appropriately hardcoded values for the | ||
// time being to minimize churn for external consumers, as we are about to rip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
// all of it out anyway. | ||
|
||
export interface RenderState { | ||
/** | ||
* Not sure why this is here, we use the owner of the template for lookups. | ||
* | ||
* Maybe this is for the render helper? | ||
* This is usually inherited from the parent (all the way up to the app | ||
* instance). However, engines uses this to swap out the owner when crossing | ||
* a mount point. | ||
*/ | ||
owner: InternalOwner; | ||
|
||
/** | ||
* The name of the parent outlet state. | ||
* @deprecated This used to specify "which parent route to render into", | ||
* which is not a thing anymore. | ||
*/ | ||
into: string | undefined; | ||
into: undefined; | ||
|
||
/* | ||
* The outlet name in the parent outlet state's outlets. | ||
/** | ||
* @deprecated This used to specify "which named outlet in the parent | ||
* template to render into", which is not a thing anymore. | ||
*/ | ||
outlet: string; | ||
outlet: 'main'; | ||
|
||
/** | ||
* The name of the route/template | ||
|
@@ -37,27 +55,42 @@ export interface RenderState { | |
/** | ||
* template (the layout of the outlet component) | ||
*/ | ||
template: Template | TemplateFactory | undefined; | ||
} | ||
|
||
export interface Outlets { | ||
[name: string]: OutletState | undefined; | ||
template: Template | undefined; | ||
} | ||
|
||
export interface OutletState { | ||
/** | ||
* Nested outlet connections. | ||
* Represents what was rendered into this outlet. | ||
*/ | ||
outlets: Outlets; | ||
render: RenderState | undefined; | ||
|
||
/** | ||
* Represents what was rendered into this outlet. | ||
* Represents what, if any, should be rendered into the next {{outlet}} found | ||
* at this level. | ||
* | ||
* This used to be a dictionary of children outlets, including the {{outlet}} | ||
* "main" outlet any {{outlet "named"}} named outlets. Since named outlets | ||
* are not a thing anymore, this can now just be a single`child`. | ||
*/ | ||
render: RenderState | undefined; | ||
outlets: { | ||
main: OutletState | undefined; | ||
}; | ||
|
||
/** | ||
* Has to do with render helper and orphan outlets. | ||
* Whether outlet state was rendered. | ||
* @deprecated | ||
* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really appreciate all these comments -- as someone who is just learning how the glue fits together, this is immensely helpful for provided much needed context as well as a bit of why |
||
* This tracks whether this outlet state actually made it onto the page | ||
* somewhere. This was more of a problem when you can declare named outlets | ||
* left and right, and anything can render into anywhere else. We want to | ||
* warn users when you tried to render into somewhere that does not exist, | ||
* but we don't know what named outlets exists until after we have rendered | ||
* everything, so this was used to track these orphan renders. | ||
* | ||
* This can still happen, if, according to the router, a route is active and | ||
* so its template should be rendered, but the parent template is missing the | ||
* `{{outlet}}` keyword, or that it was hidden by an `{{#if}}` or something. | ||
* I guess that is considered valid, because nothing checks for this anymore. | ||
* seems valid for the parent to decide not to render a child template? | ||
*/ | ||
wasUsed?: boolean; | ||
wasUsed?: undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.6.0 😅