Skip to content

await stuck indefinitely without catch #5402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Fix transitions that are parameterised with stores ([#5244](https://github.com/sveltejs/svelte/issues/5244))
* Fix scoping of styles involving child selector and `*` ([#5370](https://github.com/sveltejs/svelte/issues/5370))
* Fix destructuring which reassigns stores ([#5388](https://github.com/sveltejs/svelte/issues/5388))
* Fix `{#await}`s with no `{:catch}` getting stuck unresolved if the promise rejects ([#5401](https://github.com/sveltejs/svelte/issues/5401))

## 3.25.0

Expand Down
6 changes: 3 additions & 3 deletions src/runtime/internal/await_block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/runtime/samples/await-without-catch/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default {
})
.catch((err) => {
assert.equal(err.message, 'this error should be thrown');
assert.htmlEqual(target.innerHTML, '');
});
}
};