Skip to content

Commit 8aa033d

Browse files
authored
Merge pull request #20909 from NullVoxPopuli/nvp/remove-microtask-in-runtime-compiler
2 parents 2956905 + da1d2fd commit 8aa033d

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

packages/@ember/-internals/glimmer/tests/integration/components/runtime-template-compiler-implicit-test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,29 @@ import { fn } from '@ember/helper';
77
moduleFor(
88
'Strict Mode - Runtime Template Compiler (implicit)',
99
class extends RenderingTestCase {
10+
async '@test can immediately render a runtime-compiled template'() {
11+
class State {
12+
get component() {
13+
return template(`hello there`);
14+
}
15+
}
16+
17+
let state = new State();
18+
19+
hide(state);
20+
21+
await this.renderComponentModule(() => {
22+
return template('<state.component />', {
23+
eval() {
24+
return eval(arguments[0]);
25+
},
26+
});
27+
});
28+
29+
this.assertHTML('hello there');
30+
this.assertStableRerender();
31+
}
32+
1033
async '@test Can use a component in scope'() {
1134
await this.renderComponentModule(() => {
1235
let Foo = template('Hello, world!', {

packages/@ember/template-compiler/lib/template.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,10 @@ export function template(
242242
const normalizedOptions = compileOptions(options);
243243
const component = normalizedOptions.component ?? templateOnly();
244244

245-
queueMicrotask(() => {
246-
const source = glimmerPrecompile(templateString, normalizedOptions);
247-
const template = templateFactory(evaluate(`(${source})`) as SerializedTemplateWithLazyBlock);
245+
const source = glimmerPrecompile(templateString, normalizedOptions);
246+
const template = templateFactory(evaluate(`(${source})`) as SerializedTemplateWithLazyBlock);
248247

249-
setComponentTemplate(template, component);
250-
});
248+
setComponentTemplate(template, component);
251249

252250
return component;
253251
}

0 commit comments

Comments
 (0)