Skip to content
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

Async Children of Fragments block earlier sibling elements from being streamed #13283

Open
1 task
alexpdraper opened this issue Feb 20, 2025 · 0 comments
Open
1 task
Labels
needs triage Issue needs to be triaged

Comments

@alexpdraper
Copy link
Contributor

Astro Info

N/A — see the minimum reproducible example

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When streaming a response, if there are any promises inside of a fragment, then none of the elements in that fragment are rendered until after the promise resolves.

<Fragment>
	<p>
		I should show up before the promise resolves, but I don’t!
	</p>
	{promise.then(() => (<p>I show up after the promise resolves</p>))}
</Fragment>

Parent elements don’t normally wait for all their children, if instead of a fragment, we use a div then the first element renders right away.

<div>
	<p>
		I should show up before the promise resolves, and I do!
	</p>
	{promise.then(() => (<p>I show up after the promise resolves</p>))}
</div>

What's the expected result?

Children of fragments should not wait for sibling elements that return promises to be resolved before being streamed in the response.

<!-- This here -->
<Fragment>
	<p>
		I should show up before the promise resolves, but I don’t!
	</p>
	{promise.then(() => (<p>I show up after the promise resolves</p>))}
</Fragment>

<!-- And this here should work the same -->
<p>
	I should show up before the promise resolves, but I don’t!
</p>
{promise.then(() => (<p>I show up after the promise resolves</p>))}

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-vqmrwtqv?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant