Skip to content

Commit 87ed0b2

Browse files
authored
fix await stuck indefinitely without catch (#5402)
1 parent 1ce6ac5 commit 87ed0b2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Fix transitions that are parameterised with stores ([#5244](https://github.com/sveltejs/svelte/issues/5244))
77
* Fix scoping of styles involving child selector and `*` ([#5370](https://github.com/sveltejs/svelte/issues/5370))
88
* Fix destructuring which reassigns stores ([#5388](https://github.com/sveltejs/svelte/issues/5388))
9+
* Fix `{#await}`s with no `{:catch}` getting stuck unresolved if the promise rejects ([#5401](https://github.com/sveltejs/svelte/issues/5401))
910

1011
## 3.25.0
1112

src/runtime/internal/await_block.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ export function handle_promise(promise, info) {
5959
update(info.then, 1, info.value, value);
6060
set_current_component(null);
6161
}, error => {
62-
if (!info.hasCatch) {
63-
throw error;
64-
}
6562
set_current_component(current_component);
6663
update(info.catch, 2, info.error, error);
6764
set_current_component(null);
65+
if (!info.hasCatch) {
66+
throw error;
67+
}
6868
});
6969

7070
// if we previously had a then/catch block, destroy it

test/runtime/samples/await-without-catch/_config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
})
4040
.catch((err) => {
4141
assert.equal(err.message, 'this error should be thrown');
42+
assert.htmlEqual(target.innerHTML, '');
4243
});
4344
}
4445
};

0 commit comments

Comments
 (0)