Skip to content

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Aug 18, 2025

Implements RFC#1099 - renderComponent()

Copies over the work from

See RFC for differences between the original PR and this one:

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/RFC-1099/renderComponent branch from 9ecd8a4 to c017b13 Compare August 18, 2025 16:05
Copy link

github-actions bot commented Aug 18, 2025

Estimated Asset Sizes

Diff

--- main/out.txt	2025-08-13 03:31:42.000000000 +0000
+++ pr/./pr-17218239291/out.txt	2025-08-25 19:09:16.000000000 +0000
@@ -1,36 +1,36 @@
 ╔═══════╤═══════════╤═══════════╗
 ║       │ Min       │ Gzip      ║
 ╟───────┼───────────┼───────────╢
-║ Total │ 418.48 KB │ 231.88 KB ║
+║ Total │ 418.58 KB │ 232.08 KB ║
 ╚═══════╧═══════════╧═══════════╝
 
 ╔══════════════════════╤═══════════╤═══════════╗
 ║ @ember/*             │ Min       │ Gzip      ║
 ╟──────────────────────┼───────────┼───────────╢
-║ Total                │ 239.23 KB │ 147.06 KB ║
+║ Total                │ 239.33 KB │ 147.09 KB ║
 ╟──────────────────────┼───────────┼───────────╢
-║ -internals           │ 35.44 KB  │ 25.49 KB  ║
+║ -internals           │ 35.44 KB  │ 25.48 KB  ║
 ║ application          │ 12.83 KB  │ 7.62 KB   ║
 ║ array                │ 12.66 KB  │ 7.32 KB   ║
 ║ canary-features      │ 304 B     │ 419 B     ║
-║ component            │ 1.07 KB   │ 1004 B    ║
+║ component            │ 1.07 KB   │ 989 B     ║
 ║ controller           │ 1.8 KB    │ 1.36 KB   ║
 ║ debug                │ 11.4 KB   │ 7.92 KB   ║
 ║ deprecated-features  │ 31 B      │ 77 B      ║
 ║ destroyable          │ 561 B     │ 383 B     ║
 ║ enumerable           │ 259 B     │ 387 B     ║
-║ helper               │ 823 B     │ 570 B     ║
+║ helper               │ 823 B     │ 588 B     ║
 ║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
-║ modifier             │ 669 B     │ 614 B     ║
+║ modifier             │ 669 B     │ 585 B     ║
 ║ object               │ 33.78 KB  │ 20.79 KB  ║
 ║ owner                │ 159 B     │ 178 B     ║
-║ renderer             │ 385 B     │ 327 B     ║
-║ routing              │ 58.05 KB  │ 33.43 KB  ║
+║ renderer             │ 385 B     │ 314 B     ║
+║ routing              │ 58.05 KB  │ 33.4 KB   ║
 ║ runloop              │ 2.2 KB    │ 1.33 KB   ║
 ║ service              │ 859 B     │ 741 B     ║
-║ template             │ 430 B     │ 390 B     ║
+║ template             │ 430 B     │ 413 B     ║
 ║ template-compilation │ 429 B     │ 366 B     ║
-║ template-compiler    │ 57.81 KB  │ 30.3 KB   ║
+║ template-compiler    │ 57.91 KB  │ 30.4 KB   ║
 ║ template-factory     │ 94 B      │ 160 B     ║
 ║ test                 │ 923 B     │ 627 B     ║
 ║ utils                │ 3.93 KB   │ 3.5 KB    ║
@@ -40,7 +40,7 @@
 ╔═════════════════╤═══════════╤══════════╗
 ║ @glimmer/*      │ Min       │ Gzip     ║
 ╟─────────────────┼───────────┼──────────╢
-║ Total           │ 179.25 KB │ 84.81 KB ║
+║ Total           │ 179.25 KB │ 84.99 KB ║
 ╟─────────────────┼───────────┼──────────╢
 ║ destroyable     │ 2.7 KB    │ 1.35 KB  ║
 ║ encoder         │ 596 B     │ 653 B    ║
@@ -52,7 +52,7 @@
 ║ owner           │ 159 B     │ 202 B    ║
 ║ program         │ 7.1 KB    │ 3.63 KB  ║
 ║ reference       │ 5.51 KB   │ 3.18 KB  ║
-║ runtime         │ 95.26 KB  │ 42.51 KB ║
+║ runtime         │ 95.26 KB  │ 42.69 KB ║
 ║ tracking        │ 989 B     │ 961 B    ║
 ║ util            │ 3.03 KB   │ 2.29 KB  ║
 ║ validator       │ 15.64 KB  │ 6.86 KB  ║

Details

This PRmain
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 418.58 KB │ 232.08 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 239.33 KB │ 147.09 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 35.44 KB  │ 25.48 KB  ║
║ application          │ 12.83 KB  │ 7.62 KB   ║
║ array                │ 12.66 KB  │ 7.32 KB   ║
║ canary-features      │ 304 B     │ 419 B     ║
║ component            │ 1.07 KB   │ 989 B     ║
║ controller           │ 1.8 KB    │ 1.36 KB   ║
║ debug                │ 11.4 KB   │ 7.92 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 823 B     │ 588 B     ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
║ modifier             │ 669 B     │ 585 B     ║
║ object               │ 33.78 KB  │ 20.79 KB  ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 385 B     │ 314 B     ║
║ routing              │ 58.05 KB  │ 33.4 KB   ║
║ runloop              │ 2.2 KB    │ 1.33 KB   ║
║ service              │ 859 B     │ 741 B     ║
║ template             │ 430 B     │ 413 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 57.91 KB  │ 30.4 KB   ║
║ template-factory     │ 94 B      │ 160 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 3.93 KB   │ 3.5 KB    ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤═══════════╤══════════╗
║ @glimmer/*      │ Min       │ Gzip     ║
╟─────────────────┼───────────┼──────────╢
║ Total           │ 179.25 KB │ 84.99 KB ║
╟─────────────────┼───────────┼──────────╢
║ destroyable     │ 2.7 KB    │ 1.35 KB  ║
║ encoder         │ 596 B     │ 653 B    ║
║ env             │ 38 B      │ 87 B     ║
║ global-context  │ 886 B     │ 545 B    ║
║ manager         │ 12.19 KB  │ 5.44 KB  ║
║ node            │ 2.71 KB   │ 1.81 KB  ║
║ opcode-compiler │ 29.89 KB  │ 13.23 KB ║
║ owner           │ 159 B     │ 202 B    ║
║ program         │ 7.1 KB    │ 3.63 KB  ║
║ reference       │ 5.51 KB   │ 3.18 KB  ║
║ runtime         │ 95.26 KB  │ 42.69 KB ║
║ tracking        │ 989 B     │ 961 B    ║
║ util            │ 3.03 KB   │ 2.29 KB  ║
║ validator       │ 15.64 KB  │ 6.86 KB  ║
║ vm              │ 784 B     │ 798 B    ║
║ wire-format     │ 1.84 KB   │ 1.35 KB  ║
╚═════════════════╧═══════════╧══════════╝
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 418.48 KB │ 231.88 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 239.23 KB │ 147.06 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 35.44 KB  │ 25.49 KB  ║
║ application          │ 12.83 KB  │ 7.62 KB   ║
║ array                │ 12.66 KB  │ 7.32 KB   ║
║ canary-features      │ 304 B     │ 419 B     ║
║ component            │ 1.07 KB   │ 1004 B    ║
║ controller           │ 1.8 KB    │ 1.36 KB   ║
║ debug                │ 11.4 KB   │ 7.92 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 823 B     │ 570 B     ║
║ instrumentation      │ 2.43 KB   │ 1.78 KB   ║
║ modifier             │ 669 B     │ 614 B     ║
║ object               │ 33.78 KB  │ 20.79 KB  ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 385 B     │ 327 B     ║
║ routing              │ 58.05 KB  │ 33.43 KB  ║
║ runloop              │ 2.2 KB    │ 1.33 KB   ║
║ service              │ 859 B     │ 741 B     ║
║ template             │ 430 B     │ 390 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 57.81 KB  │ 30.3 KB   ║
║ template-factory     │ 94 B      │ 160 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 3.93 KB   │ 3.5 KB    ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤═══════════╤══════════╗
║ @glimmer/*      │ Min       │ Gzip     ║
╟─────────────────┼───────────┼──────────╢
║ Total           │ 179.25 KB │ 84.81 KB ║
╟─────────────────┼───────────┼──────────╢
║ destroyable     │ 2.7 KB    │ 1.35 KB  ║
║ encoder         │ 596 B     │ 653 B    ║
║ env             │ 38 B      │ 87 B     ║
║ global-context  │ 886 B     │ 545 B    ║
║ manager         │ 12.19 KB  │ 5.44 KB  ║
║ node            │ 2.71 KB   │ 1.81 KB  ║
║ opcode-compiler │ 29.89 KB  │ 13.23 KB ║
║ owner           │ 159 B     │ 202 B    ║
║ program         │ 7.1 KB    │ 3.63 KB  ║
║ reference       │ 5.51 KB   │ 3.18 KB  ║
║ runtime         │ 95.26 KB  │ 42.51 KB ║
║ tracking        │ 989 B     │ 961 B    ║
║ util            │ 3.03 KB   │ 2.29 KB  ║
║ validator       │ 15.64 KB  │ 6.86 KB  ║
║ vm              │ 784 B     │ 798 B    ║
║ wire-format     │ 1.84 KB   │ 1.35 KB  ║
╚═════════════════╧═══════════╧══════════╝

@NullVoxPopuli NullVoxPopuli force-pushed the nvp/RFC-1099/renderComponent branch from f0d7327 to 54845d7 Compare August 25, 2025 02:53
There's more in this commit than there should be, largely because this
commit bundles a change to the plugins that fixes lexical scope bugs.

I intend to separate those changes out into their own PR before
attempting to merge this one. This PR also needs a flag for the new API.

Finally this commit adds some new testing infrastructure to generalize
the base render tests so it can be used with templates that are not
registered into a container. This is useful more generally, and could
be used in other places in the test suite in the future.
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/RFC-1099/renderComponent branch from 54845d7 to be16cb2 Compare August 25, 2025 03:01
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review August 25, 2025 16:59
@kategengler kategengler requested a review from ef4 August 25, 2025 17:17
buildOwner,
clickElement,
defComponent,
defineComponent,
Copy link
Member

Choose a reason for hiding this comment

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

what's the difference between defComponent and defineComponent? 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

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

defineComponent is traditional loosemode and defComponent is strict only

Copy link
Contributor

Choose a reason for hiding this comment

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

why not defineStrictComponent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

idk -- this code was copied from a prior implementation attempt

It's ultimately not important right now, but I'm happy to rename this util in a separate PR 🎉

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 should clarify, yesterday I wasn't in a mood to push updates unless there were more comments to make pushing (and all of CI) worthwhile.

Apologies -- defineStrictComponent is just obectively better, and I'll rename. thank you for the suggestion! <3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, I was wrong:

/**
 * The signature of this test helper is closer to the signature of the
 * `template()` function in `@ember/template-compiler`. It can express the same
 * functionality as {@linkcode defineComponent}, but most tests still use
 * `defineComponent`. Migrating tests from {@linkcode defineComponent} is
 * straightforward, and there's no *semantic* reason not to do so.
 */

it seems I should punt on changes here and instead make template work in tests (and get rid of this helper)

Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than template(), I think it would be fine to go straight to <template></template> in the tests.

The test suite runs in Vite, if it doesn't already have template tag support enabled adding it should be trivial.

@NullVoxPopuli NullVoxPopuli mentioned this pull request Aug 28, 2025
11 tasks
});
}

'@skip when args are a custom tracked class, the rendered component response appropriately'() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why this doesn't just naturally work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, I consider this not working as a bug -- i suspect it is because of how ArgsProxy relies on Object.keys and @tracked properties are not enumerable.

Fixing this may require changes to how we handle args / ArgsProxy

Copy link
Contributor

Choose a reason for hiding this comment

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

Oof, yeah, non-enumerability of tracked always sneaks up on me. You don't notice it until you notice it.

Copy link
Contributor

@ef4 ef4 left a comment

Choose a reason for hiding this comment

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

I commented above on refactoring goal for tests and also asked a question about a skipped test, but neither of those is a blocker for this PR.

@kategengler kategengler merged commit 7b3da74 into emberjs:main Aug 30, 2025
29 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/RFC-1099/renderComponent branch August 30, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants