#Data fetching

3 messages · Page 1 of 1 (latest)

devout hamlet
#

When does data fetch in astro collections?

neat badgerBOT
#

Hi @devout hamlet. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Data fetching in Astro collections typically occurs at build time. According to the Astro Content Loader API documentation, the load() method of a loader is called at build time to fetch data and update the data store.

For example, when using the built-in glob() or file() loaders, or when creating a custom loader, the data is fetched when the collection is processed during the build process. This means that the content is available for use in your Astro components without needing to fetch it again at runtime.

However, it's important to note that if you're using Server-Side Rendering (SSR) mode in Astro, the behavior might be different. In SSR mode, data fetching could occur at request time, depending on how you've structured your application.

If you need more specific information about data fetching in a particular context or setup, please provide more details about your use case.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: