SWR vs maxStaleAge
How do swr and maxStaleAge in a defineCachedEventHandler play together? The docs say:
Enable stale-while-revalidate behavior to serve a stale cached response while asynchronously revalidating it. Defaults to true.
Maximum age that a stale cache is valid, in seconds. If set to -1 a stale value will still be sent to the client while the cache updates in the background. Defaults to 0 (disabled).
So
swr: booleanEnable stale-while-revalidate behavior to serve a stale cached response while asynchronously revalidating it. Defaults to true.
staleMaxAge: numberMaximum age that a stale cache is valid, in seconds. If set to -1 a stale value will still be sent to the client while the cache updates in the background. Defaults to 0 (disabled).
So
swr defaults to true, and a stale cached response should be served. However, staleMaxAge defaults to 0, which means a stale cache is always invalid and will not be served to the client? This doesn't make any sense, does anyone have insight?