From 3054ef986d0f6a64555bf47ffdf7f6468b224585 Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Tue, 15 Sep 2020 20:46:12 +0800 Subject: [PATCH] await stuck indefinitely without catch --- src/runtime/internal/await_block.ts | 6 +++--- test/runtime/samples/await-without-catch/_config.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/runtime/internal/await_block.ts b/src/runtime/internal/await_block.ts index 3821520837..4b7ca6fd21 100644 --- a/src/runtime/internal/await_block.ts +++ b/src/runtime/internal/await_block.ts @@ -59,12 +59,12 @@ export function handle_promise(promise, info) { update(info.then, 1, info.value, value); set_current_component(null); }, error => { - if (!info.hasCatch) { - throw error; - } set_current_component(current_component); update(info.catch, 2, info.error, error); set_current_component(null); + if (!info.hasCatch) { + throw error; + } }); // if we previously had a then/catch block, destroy it diff --git a/test/runtime/samples/await-without-catch/_config.js b/test/runtime/samples/await-without-catch/_config.js index 2030ed7949..1b7da5c0be 100644 --- a/test/runtime/samples/await-without-catch/_config.js +++ b/test/runtime/samples/await-without-catch/_config.js @@ -39,6 +39,7 @@ export default { }) .catch((err) => { assert.equal(err.message, 'this error should be thrown'); + assert.htmlEqual(target.innerHTML, ''); }); } }; \ No newline at end of file