diff --git a/src/generators/nodes/AwaitBlock.ts b/src/generators/nodes/AwaitBlock.ts
index 61fa2f053e..f47f5de61b 100644
--- a/src/generators/nodes/AwaitBlock.ts
+++ b/src/generators/nodes/AwaitBlock.ts
@@ -69,6 +69,7 @@ export default class AwaitBlock extends Node {
const name = this.var;
const anchor = this.getOrCreateAnchor(block, parentNode);
+ const updateMountNode = this.getUpdateMountNode(anchor);
const params = block.params.join(', ');
@@ -107,7 +108,7 @@ export default class AwaitBlock extends Node {
${old_block}.u();
${old_block}.d();
${await_block}.c();
- ${await_block}.m(${parentNode || `${anchor}.parentNode`}, ${anchor});
+ ${await_block}.m(${updateMountNode}, ${anchor});
}
}
diff --git a/test/runtime/samples/await-then-catch-in-slot/Foo.html b/test/runtime/samples/await-then-catch-in-slot/Foo.html
new file mode 100644
index 0000000000..49aeb95a1d
--- /dev/null
+++ b/test/runtime/samples/await-then-catch-in-slot/Foo.html
@@ -0,0 +1 @@
+
loading...
+ `, + + test(assert, component, target) { + fulfil(42); + + return thePromise + .then(() => { + assert.htmlEqual(target.innerHTML, ` +the value is 42
+ `); + + let reject; + + thePromise = new Promise((f, r) => { + reject = r; + }); + + component.set({ + thePromise + }); + + assert.htmlEqual(target.innerHTML, ` +loading...
+ `); + + reject(new Error('something broke')); + + return thePromise.catch(() => {}); + }) + .then(() => { + assert.htmlEqual(target.innerHTML, ` +oh no! something broke
+ `); + }); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/await-then-catch-in-slot/main.html b/test/runtime/samples/await-then-catch-in-slot/main.html new file mode 100644 index 0000000000..34519e8c23 --- /dev/null +++ b/test/runtime/samples/await-then-catch-in-slot/main.html @@ -0,0 +1,17 @@ +loading...
+ {{then theValue}} +the value is {{theValue}}
+ {{catch theError}} +oh no! {{theError.message}}
+ {{/await}} +