Hi,
I have a minimal Nuxt 3 app with different pages set up to use different rendering modes.
https://extraordinary-zuccutto-58a082.netlify.app
nuxt.config is as following:
export default defineNuxtConfig({
ssr: true,
routeRules: {
"/isr_ttl": { isr: 60 },
"/isr_no_ttl": { isr: true },
"/swr_ttl": { swr: 60 },
"/swr_no_ttl": { swr: true },
},
});
I use 2 timestamps to check whether caching works as expected: one comes from API response, another one is rendered in browser.
I tried deploying this app with different nitro presets or without a preset at all and all of the deploys produce unexpected behaviour with at least some rendering modes. Please see the summary below:
NITRO_PRESET = netlify_builder
SSR: cached for at least 2 mins
SWR without TTL: cached permanently
SWR with TTL of 60 seconds: cached permanently
ISR without TTL: cached permanently
ISR with TTL of 60 seconds: cached permanently
Unexpected behaviour:
SSR (expected no caching),
SWR without TTL (expected to be cached until response changes),
SWR with TTL of 60 seconds (expected to be cached for 60 seconds),
ISR with TTL of 60 seconds (expected to be cached for 60 seconds),
NITRO_PRESET = netlify_edge
SSR: no caching
SWR without TTL: cached until response changes
SWR with TTL of 60 seconds: cached for 60 seconds
ISR without TTL: no caching
ISR with TTL of 60 seconds: no caching
Unexpected behaviour:
ISR without TTL (expected to be cached permanently),
ISR with TTL of 60 seconds (expected to be cached for 60 seconds),
NITRO_PRESET = netlify
SSR: no caching
SWR without TTL: cached permanently
SWR with TTL of 60 seconds: cached permanently
ISR without TTL: cached permanently
ISR with TTL of 60 seconds: cached permanently
Unexpected behaviour:
SWR without TTL (expected to be cached until response changes),
SWR with TTL of 60 seconds (expected to be cached for 60 seconds),
ISR with TTL of 60 seconds (expected to be cached for 60 seconds),
no NITRO_PRESET
SSR: no caching
SWR without TTL: cached permanently
SWR with TTL of 60 seconds: cached permanently
ISR without TTL: cached permanently
ISR with TTL of 60 seconds: cached for at least 2 mins
Unexpected behaviour:
SWR without TTL (expected to be cached until response changes),
SWR with TTL of 60 seconds (expected to be cached for 60 seconds),
ISR with TTL of 60 seconds (expected to be cached for 60 seconds),
Can someone please advise what should be the proper preset to use for these rendering modes and in general, how to fix the issue to make sure that they work as expected?