next.js
4e0b1125 - Improve error handling for `headers`/`cookies`/`draftMode` in `'use cache'` (#81716)

Commit
165 days ago
Improve error handling for `headers`/`cookies`/`draftMode` in `'use cache'` (#81716) This ensures that we show a proper error with an error stack (potentially source-mapped) when accessing `headers`/`cookies`/`draftMode` in `'use cache'`, even when caught in user-land code. For `searchParams` (currently triggering a timeout error) we'll need a slightly different solution, which will be handled in a future PR. The approach chosen here is somewhat temporary, as we'd like to implement compile-time errors instead for accessing any kind of request data in `'use cache'` functions. However, this would require a larger change to our bundlers. closes NAR-201
Author
Parents
Loading