You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Runtime compiler does not correctly generate the scope bag, and is thus non-reactive (incorrectly reactive?) #20913
here, I added untrack because we should not be touching scope or any reactive values before a render occurs (else, we just re-run things over and over again).
so... what should happen is obviously just... not mutating the shape of the scope bag
instead of:
"scope":()=>[greeting]
we need to take the scope that was passed to template, and use that directly.
like this:
// in the template compilerexportfunctiontemplate(source,{ scope }){// .... // using old terminology here, cause I don't remember what the new stuff isreturnsetComponentTemplate({block: '[...]',
scope,isStrictMode: true,},templateOnly(),);}
I don't think scope names can be dynamic -- else it'd require re-compiling the component, which I think is fine (but also, how do you do dynamic scope in JS? (lots of eval?))
The runtime template compiler is not subject to the same limitations as the ahead-of-time template compiler. There's no reason all of it needs to go through new Function(...). And we can emit the scope-bag-consuming expressions directly inside the closure like () => [scopeBag.foo]
Activity
krisselden commentedon Jun 2, 2025
If scope names are dynamic, you do need to version the list of keys, but it should be able to just host/pass through values a unconsumed.
NullVoxPopuli commentedon Jun 3, 2025
I don't think scope names can be dynamic -- else it'd require re-compiling the component, which I think is fine (but also, how do you do dynamic scope in JS? (lots of eval?))
ef4 commentedon Jun 3, 2025
The runtime template compiler is not subject to the same limitations as the ahead-of-time template compiler. There's no reason all of it needs to go through
new Function(...). And we can emit the scope-bag-consuming expressions directly inside the closure like() => [scopeBag.foo]NullVoxPopuli commentedon Jun 3, 2025
how's that work?
NullVoxPopuli commentedon Aug 2, 2026
Current state of the incorrect transform our babel plugin does
note how the scope bag lost its contents.
I think this would be a fix to babel-plugin-ember-template-compilation next
When using the
/runtimeexplicit compiler, we still incorrectly / eagerly evaluate the scope bagThis results in repeated compilation for changes in tracked state.
A work around:
(using a thunk )