next.js
90a49278 - fix: use RDC for server action requests (#88129)

Commit
16 hours ago
fix: use RDC for server action requests (#88129) When a server action triggers a re-render of the underlying page (eg by calling `refresh()`), cached data that was part of the Resume Data Cache (RDC) was not provided to the server action handler, and so those parts of the UI would update with new data. A subsequent refresh of the page would revert back to the ISR data, which means the server action causes the data to temporarily get into an "ahead" state that will never actually be reflected in the ISR shell. This provides the RDC data to the server action handler. For self-hosted deployments, Next.js can look up the cached entry directly since the cache and renderer are co-located. For deployments on Vercel, the caching layer and rendering layer are separate services, and server actions bypass the cache. This means the serverless function has no way to access the cached RDC on its own, so the underlying CDN must fetch it and pass it via the request body. The `x-next-resume-state-length` is sent to the serverless function so that it can determine how to split off the RDC data from the action body. Fixes NAR-478 Fixes NAR-502
Author
Parents
Loading