0

I've noticed that with Astrojs it appears that the page setting is dominate when it comes to executing a request as static or SSR. What I mean by this is: If page is marked static and endpoint is marked SSR the whole thing is executed as Static. If page is marked SSR and endpoint is marked static the whole thing is executed as SSR.

The endpoints themselves execute as expected (SSR or static) when called standalone.

My config marked output: 'server' in astro.config.mjs with node adapter and used export const prerender = true or false as needed in each file.

So my question is, is this the behaviour you'd expect from Astrojs. The documentation does not seem to mention it.

The endpoints were doing fetches to a rest server on the internet. I built the Astro app with pnpm build --remote and run pnpm preview. Each endpoint was retrieving a full list of users. The static pages did retrieve the full list as expected. I then added a new user to the remote rest server and re-ran the static pages (with SSR endpoints). But the results did not include the new user. I then ran the SSR pages (with static endpoints) and the results included the new user. Browser caching is turned off.

2
  • what exactly do you mean with "page is marked static" and "whole thing is executed as Static"? Commented Oct 9 at 14:04
  • Page is marked static means: export const prerender = true. Whole thing is executed means: page is requested which calls the endpoint which executes the fetch and returns the data. Commented Oct 9 at 15:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.