#Why does the content layer API fetch data twice
3 messages · Page 1 of 1 (latest)
Hi @drifting depot. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the knowledge sources provided, there isn't specific information about the Content Layer API fetching data twice or why this might occur. The documentation doesn't mention this behavior as an expected or common issue.
However, it's worth noting that the Content Layer API is a relatively new feature in Astro, introduced in version 5.0. If you're experiencing unexpected behavior, it could potentially be related to how your custom loader is implemented or how it interacts with Astro's build process.
To better understand and potentially resolve this issue, you might want to:
-
Double-check your custom loader implementation to ensure it's not inadvertently triggering multiple data fetches.
-
Consider using the
refreshContentfunction, which is part of theastro:server:setuphook. This function is designed to update the content layer during development and might provide more control over when data is fetched Astro Integration API. -
Review the full Content Loader API documentation to ensure your loader is implemented correctly and efficiently.