[BUGFIX] Re-render dynamic components in append position when the definition changes#21470
Merged
Conversation
…hanges
Previously, when a component definition rendered in append position
(e.g. `{{if @isok Ok Ko}}` or `{{@foo}}`) changed to a *different*
component definition, nothing invalidated the rendered component: the
content-type guard only re-renders when the content *type* changes
(component -> string, etc.), and the curried component was resolved
once on initial render.
Emit AssertSame before resolving the curried component in the dynamic
append paths (stdlib StdAppend and the dynamic call append in
statement compilation), mirroring the existing String/SafeString/
Fragment/Node branches and the Assert that InvokeDynamicComponent
already gets via Replayable. When the definition reference's value
changes, the enclosing Enter/Exit region is cleared and re-rendered
with the new component.
Fixes #21042
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
📊 Size reportTarball size — dist/dev 0%↑
dist/prod 0%↑
smoke-tests/v2-app-template/dist 0.01%↑
smoke-tests/v2-app-hello-world-template/dist 0.01%↑
🤖 This report was automatically generated by wyvox/pkg-size |
kategengler
approved these changes
Jun 12, 2026
lifeart
added a commit
to lifeart/ember.js
that referenced
this pull request
Jun 12, 2026
…nentManager The shim's setComponentManager writes COMPONENT_MANAGERS (custom managers) while hasInternalComponentManager only walked INTERNAL_MANAGERS — so the VM's dynamicContentType classified a custom-managed component class as a HELPER (the shim treats any function as a default helper) and the helper path CALLED the class: "Class constructor definition cannot be invoked without 'new'". Never tripped before because the resolve path (getInternalComponentManager) already consulted both maps; upstream emberjs#21470's new AssertSame opcode re-enters the dynamic-append region on definition change and re-runs DYNAMIC_CONTENT_TYPE on the swapped class, which is exactly what its new test exercises. The has-predicate now mirrors the getter's two-phase walk (and upstream @glimmer/manager's single-registry semantics). Found via CDP pause-on-exceptions (QUnit strips uncaught-in-render throw stacks; see zzprobe-stack-dc.mjs). Gates (with the emberjs#21470 merge, both modes): dev 9460/9443/17/0 exact in fallback AND hook mode, prod 9310/9246/0, smokes 7/7; the three new strict-mode dynamic-definition tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #21042
REPL Test: NullVoxPopuli/limber#2169
Deployed: https://test-ember-source-nvp-fix-21.limber-glimdown.pages.dev/
Demonstrated fix: https://test-ember-source-nvp-fix-21.limber-glimdown.pages.dev/edit?c=JYWwDg9gTgLgBAYQuCA7Apq%2BAzKy4DkAAgOYA2oI6UA9AMbKQZYEDcAUKJLHAN5wwoAQzoBrdABM4AXzi58xcpWo1BI0cFQk27dg1QBneAHlRcALxwAPDHTgyQ2wD5TV1XbAPnHfUbgBpCAtrW3tHdCdAt1DPcKcOPTQ-ADEKMDBqYJsPLwj2OD5eYGw4ImADUzhKwOlpXQLeXgBiYtLy01r8gu6rSponLsb0MgN0Tu6ewLh%2Bwd4aYs7onLiE9AAPbngJdGwhAFcyeDoHAwM4ABE7IPXbVAkzpBRmeF4uojUxSTh2s0tdkfQHAK2DSwQAFABKCxOAQAC3KADofsEAIQweEGJEVUQJArZMLOLp41LAdKZMrY8yNdGIn61aYDCZWABGexgMDQcDQx2AYipvBpmJBpNqThJYDcrPZaEZ1ncBLy0iAA&format=gjs
(same code from the issue report)