Skip to content

Remove layout/layoutName from classic Component#21284

Draft
NullVoxPopuli-ai-agent wants to merge 1 commit intoemberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/remove-layout-layoutName
Draft

Remove layout/layoutName from classic Component#21284
NullVoxPopuli-ai-agent wants to merge 1 commit intoemberjs:mainfrom
NullVoxPopuli-ai-agent:nvp/remove-layout-layoutName

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown

Summary

  • Remove layout and layoutName properties from classic Component
  • Curly component manager now uses getComponentTemplate() to resolve templates, aligning with Glimmer components
  • render() in test infrastructure uses template() from @ember/template-compiler/runtime instead of internal compile + layoutName
  • Tests using layoutName rewritten to use setComponentTemplate
  • Tests specifically testing layout/layoutName behavior removed

This unblocks eliminating the internal compile from render(), since template() + setComponentTemplate now works for classic components through getComponentTemplate.

Test plan

  • 8908 tests pass (4 removed that tested layout/layoutName specifically)
  • Build and lint pass

🤖 Generated with Claude Code

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent force-pushed the nvp/remove-layout-layoutName branch from dd38f95 to fbedb2b Compare April 3, 2026 02:52
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

NullVoxPopuli commented Apr 3, 2026

For context, I believe we dropped support for this in v6, per: https://deprecations.emberjs.com/id/component-template-resolving

we only support component-co-location, and gjs/gts.

@type Function
@public
*/
declare layout?: TemplateFactory | Template;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did we ever deprecate this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've been treating it like a shadow-deprecation from https://deprecations.emberjs.com/id/component-template-resolving

testing a new app tho with layout doesn't work as I expect: https://github.com/NullVoxPopuli/my-app-trying-to-use-layout-pls-dont-no-one-look-please-use-gjs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suppose I should try Ember 5.12 tho, cause the deprecation was probably removed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5.12 with vite has the same behavior as 6.11+ with vite -- not working (good)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5.8 classic also doesn't have layout working.

or something since 5.8 prevents hbs files from being imported "as templates"

The curly component manager now uses getComponentTemplate() to resolve
templates, aligning with how Glimmer components work. The layout and
layoutName properties are removed from Component.

Changes:
- curly.ts: templateFor() uses getComponentTemplate(component.constructor)
  instead of layout/layoutName properties
- component.ts: remove layout and layoutName property declarations
- rendering.ts, router-non-application.ts: render() uses template() from
  @ember/template-compiler/runtime instead of compile + layoutName
- abstract-application.ts: remove compile method
- Tests using layoutName rewritten to use setComponentTemplate
- Tests specifically testing layout/layoutName behavior removed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent force-pushed the nvp/remove-layout-layoutName branch from fbedb2b to c1cc192 Compare April 3, 2026 03:05
declare layout?: TemplateFactory | Template;

/**
The name of the layout to lookup if no layout is provided.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any form of looking up was deprecated during 5.x

@@ -132,24 +131,12 @@ export default class CurlyComponentManager
WithDynamicTagName<ComponentStateBucket>
{
protected templateFor(component: Component): CompilableProgram | null {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm currently exploring if I can get rid of templateFor, but will save that for a separate PR

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Just found out if you manually import { precompileTempalte } from '@ember/template-compilation', and set layout, it works.

I don't like it, but it means this (and a bunch of other cleanup) needs to wait until v8

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Gonna close, because it's too early to do anything here -- and layout still works if folks can somehow get a non-component template

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Todo:

  • find oldest ember-source that generates a component with layout
  • upgrade project to ember 6.12
  • does it work? if no, we can proceed with this PR?, marking draft for now

@NullVoxPopuli NullVoxPopuli reopened this Apr 3, 2026
@kategengler
Copy link
Copy Markdown
Member

Todo:

  • find oldest ember-source that generates a component with layout
  • upgrade project to ember 6.12
  • does it work? if no, we can proceed with this PR?, marking draft for now

This should be:

  • Find newest ember-source version that generates a component using layout in an addon
  • Generate an addon with that version + component
  • Use the addon in a 6.x app -- does the component work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants