next.js
c316c79a - [Cache Components] Fix revalidation of prerendered route handlers (#83375)

Commit
119 days ago
[Cache Components] Fix revalidation of prerendered route handlers (#83375) When a prerendered and deployed route handler is revalidated, we can not rely on having a cache handler that does in-memory caching. So we need to provide a prerender resume data cache (RDC) instead, to ensure that the revalidation doesn't fail with the following error: ``` Error: Dynamic server usage: Route / couldn't be rendered statically because it used IO that was not cached. ``` Route handlers are never resumed, so it's counter-intuitive to use an RDC for this scenario. However, we need the data cache to store cached results in memory during the prospective prerender, so that they can be retrieved during the final prerender within microtasks. In a follow-up, we should replace the `prerenderResumeDataCache` and `renderResumeDataCache` with a single `dataCache` property that is conceptually not tied to resuming, and also avoids the unnecessary complexity of using a mutable and an immutable resume data cache. closes NAR-350
Author
Parents
Loading