next.js
a3500c32 - [test] Fix deploy test of `cache-components.server-action.test.ts` (#88854)

Commit
1 day ago
[test] Fix deploy test of `cache-components.server-action.test.ts` (#88854) When deployed, the sentinels where showing `at runtime` instead of `at buildtime`. There are two reasons for this: 1. The page sentinel was accidentally rendered in a client component, which causes a hydration mismatch, and the value toggling from `at buildtime` to `at runtime` when the page is hydrated before the assertion is done. 2. The middleware was setting sentinel cookies that are intended for the `/cookies/*` pages, but not for the `/server-action-inline` page. This caused the server action (which is triggered in the second test) to consider the page as revalidated, which then led the client router to refetch the page. With `next start` this is not a problem because the RSC response is prerendered at build time, and returned as a static file, which contains the correct sentinel values. However, when deployed on Vercel, the RSC request results in an ISR cache miss for some reason, which causes the page to be revalidated (with runtime sentinel values), and then the third test fails when it receives the regenerated response instead of the build-time prerender result. This needs to be investigated separately, but for now we disable the middleware from setting cookies on this page to prevent the ISR revalidation request. closes #88817 closes NAR-740 > [!TIP] > Best reviewed with hidden whitespace changes.
Author
Parents
Loading