Astro Info
block
Astro v5.3.0
Node v22.12.0
System Windows (x64)
Package Manager npm
Output server
Adapter none
Integrations none
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In the following example only link a works.
All links work if top level await in Deferred.astro is removed.
astro.config.mjs
import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({
output: 'server',
prefetch: true
});
index.astro
---
import Deferred from '../components/Deferred.astro';
---
<h1>Home</h1>
<p>{new Date().toString()}</p>
<Deferred server:defer link="/about-a"/>
<Deferred link="/about-b"/>
Deferred.astro
---
const { link } = Astro.props;
const getMsg = async () => {
return new Promise ((resolve) => {
setTimeout(() => {
resolve(`This is the message for ${link}`);
}, 100);
});
}
const res = await getMsg();
---
<a href={link} data-astro-prefetch>{link}</a>
about-a.astro
about-b.astro
<h1>About</h1>
<a href="/">Home</a>
What's the expected result?
Expect prefetch to work for both links, including the one with server:defer and top level-await.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-dzimzdt7
Participation
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
In the following example only link a works.
All links work if top level await in Deferred.astro is removed.
astro.config.mjs
index.astro
Deferred.astro
about-a.astro
about-b.astro
What's the expected result?
Expect prefetch to work for both links, including the one with server:defer and top level-await.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-dzimzdt7
Participation