Skip to content

fix: await issue with fragment#1067

Merged
ematipico merged 5 commits intowithastro:mainfrom
mertmit:fix/async-fragment
Mar 6, 2025
Merged

fix: await issue with fragment#1067
ematipico merged 5 commits intowithastro:mainfrom
mertmit:fix/async-fragment

Conversation

@mertmit
Copy link
Copy Markdown
Contributor

@mertmit mertmit commented Mar 4, 2025

Changes

Testing

Printing following payload:

<body><Fragment> { await Promise.resolve("Awaited") } </Fragment></body>

Docs

bug fix

mertmit added 2 commits March 4, 2025 07:38
Signed-off-by: mertmit <mertmit99@gmail.com>
Signed-off-by: mertmit <mertmit99@gmail.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 4, 2025

🦋 Changeset detected

Latest commit: c208f07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ematipico
Copy link
Copy Markdown
Member

Thank you @mertmit

There are a couple of things missing:

  • a changeset that explains the entity of the fix; the contribution guide should explain how to add one
  • a test that matches the bug filed in the issue

Signed-off-by: mertmit <mertmit99@gmail.com>
@mertmit
Copy link
Copy Markdown
Contributor Author

mertmit commented Mar 4, 2025

Hi @ematipico
I've added the changeset.
Test is already included and it covers exact same scenario (await expression inside fragment).

@ematipico
Copy link
Copy Markdown
Member

I know, but the code provided by the user is different from the test, hence my request

@ascorbic
Copy link
Copy Markdown
Contributor

ascorbic commented Mar 4, 2025

Thanks. The bug affects all Astro component wrappers, not just Fragments. Will this work with others too? It would be good to have a test for shorthand Fragment syntax too.

mertmit added 2 commits March 4, 2025 15:28
Signed-off-by: mertmit <mertmit99@gmail.com>
Signed-off-by: mertmit <mertmit99@gmail.com>
@mertmit
Copy link
Copy Markdown
Contributor Author

mertmit commented Mar 4, 2025

@ascorbic it seems it should work for others as well (it should only effect formerly broken ones so I believe it is safe)
I just came across astro so I am not very familiar with concepts so please double confirm.

@ematipico added that scenario as well as shorthand usage.
I also added a test scenario for Component usage.

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@ematipico ematipico merged commit c758d7e into withastro:main Mar 6, 2025
4 of 5 checks passed
@mertmit mertmit deleted the fix/async-fragment branch March 6, 2025 22:39
@jlwalkerlg
Copy link
Copy Markdown

@ematipico any idea when this fix is likely to be released? Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Await doesn't work inside of Fragments

4 participants