-
Notifications
You must be signed in to change notification settings - Fork 652
Open
Labels
type:unverified bugA bug report that has not been verifiedA bug report that has not been verified
Description
Marko Version: 6.0.37
Details
The following code produces the expected result:
static const resolveAfter = (duration) =>
new Promise((resolve) => setTimeout(resolve, duration));
static const rejectAfter = (duration) =>
new Promise((_, reject) => setTimeout(reject, duration));
<try>
<@placeholder>
<div>wait a</div>
</@placeholder>
<@catch>
<div>error a</div>
</@catch>
<await|_|=resolveAfter(500)>
<div>result a</div>
</await>
</try>
<try>
<@placeholder>
<div>wait b</div>
</@placeholder>
<@catch>
<div>error b</div>
</@catch>
<await|_|=rejectAfter(300)>
<div>result b</div>
</await>
</try>
Ie, I see the following output:
- wait a + wait b
- wait a + error b
- result a + error b
But if I removed the placeholders in both of them, I only see "result a", with nothing from the second try block.
If I additionally swapped the order of the of the blocks, I get the expected result, which is "error b + result a".
It looks like it doesn't like it when later promises reject before earlier promise resolve (or reject for that matter). This reminds me of this blog post: https://jakearchibald.com/2023/unhandled-rejections/, so maybe it's the same root cause?
Metadata
Metadata
Assignees
Labels
type:unverified bugA bug report that has not been verifiedA bug report that has not been verified