@decocms/blocks 7.16.4 → 7.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/blocks",
3
- "version": "7.16.4",
3
+ "version": "7.16.5",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -213,12 +213,21 @@ export function edgeCacheConfig(profile: CacheProfileName): EdgeCacheConfig {
213
213
  *
214
214
  * In dev mode, uses short staleTime (5s) to keep data fresh enough for
215
215
  * development while avoiding redundant re-fetches.
216
+ *
217
+ * staleTime is always Infinity in production: TanStack Router v1 dehydrates
218
+ * SSR route data with updatedAt: 0, so any finite staleTime makes SSR data
219
+ * appear immediately stale on client hydration. That triggers a second
220
+ * /_serverFn/loadCmsPage request — a separate Worker isolate that re-runs all
221
+ * loaders (including Magento ResolveURL/GetCompleteProduct) and doubles the
222
+ * origin load on every first navigation. With Infinity, TanStack Router never
223
+ * time-based-refetches in-memory data; gcTime controls how long the data lives
224
+ * in memory, and the Cloudflare edge cache handles actual data freshness. (#355)
216
225
  */
217
226
  export function routeCacheDefaults(profile: CacheProfileName): { staleTime: number; gcTime: number } {
218
227
  const env = typeof globalThis.process !== "undefined" ? globalThis.process.env : undefined;
219
228
  const isDev = env?.DECO_CACHE_DISABLE === "true" || env?.NODE_ENV === "development";
220
229
  if (isDev) return { staleTime: 5_000, gcTime: 30_000 };
221
- return { ...PROFILES[profile].client };
230
+ return { staleTime: Infinity, gcTime: PROFILES[profile].client.gcTime };
222
231
  }
223
232
 
224
233
  // ---------------------------------------------------------------------------