From ac296cc440bd8f4de7fea98e4c30dfb2de5adb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADcholas=20Andr=C3=A9?= Date: Thu, 16 Jan 2025 16:44:15 -0300 Subject: [PATCH] fix: fix next params --- packages/next-redis-cache-provider/src/index.ts | 2 +- packages/next/src/rsc/data/queries/prepareQuery.ts | 2 +- projects/wp-nextjs-app/next.config.js | 1 + projects/wp-nextjs-app/src/app/page.tsx | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/next-redis-cache-provider/src/index.ts b/packages/next-redis-cache-provider/src/index.ts index e0d7733f5..68fcb6e83 100644 --- a/packages/next-redis-cache-provider/src/index.ts +++ b/packages/next-redis-cache-provider/src/index.ts @@ -145,7 +145,7 @@ export default class RedisCache implements CacheHandler { } private buildKey(key: string) { - if (this.ctx._appDir) { + if (typeof this.BUILD_ID === 'undefined') { return key; } diff --git a/packages/next/src/rsc/data/queries/prepareQuery.ts b/packages/next/src/rsc/data/queries/prepareQuery.ts index 7aaa933e5..528f46ca5 100644 --- a/packages/next/src/rsc/data/queries/prepareQuery.ts +++ b/packages/next/src/rsc/data/queries/prepareQuery.ts @@ -39,7 +39,7 @@ export function prepareQuery

( const options = merge['options']>([ { - cache: 'no-store', + cache: typeof rest.options?.next?.revalidate === 'undefined' ? 'no-store' : undefined, }, rest.options ?? {}, ]); diff --git a/projects/wp-nextjs-app/next.config.js b/projects/wp-nextjs-app/next.config.js index c54437536..f0f9bb11f 100644 --- a/projects/wp-nextjs-app/next.config.js +++ b/projects/wp-nextjs-app/next.config.js @@ -15,6 +15,7 @@ if (process.env.NEXT_REDIS_URL || process.env.VIP_REDIS_PRIMARY) { initRedisClient(); nextConfig.cacheHandler = require.resolve('@10up/next-redis-cache-provider'); + nextConfig.cacheMaxMemorySize = 0; } module.exports = withHeadstartWPConfig(nextConfig); diff --git a/projects/wp-nextjs-app/src/app/page.tsx b/projects/wp-nextjs-app/src/app/page.tsx index a27c058ee..98ec79f83 100644 --- a/projects/wp-nextjs-app/src/app/page.tsx +++ b/projects/wp-nextjs-app/src/app/page.tsx @@ -10,7 +10,6 @@ async function query({ params }: HeadstartWPRoute) { postType: 'page', }, options: { - cache: 'force-cache', next: { revalidate: 60, tags: ['home'],