next.js
ae5026a0 - Unused `searchParams` in `"use cache"` page should not cause dynamic (#75662)

Commit
1 year ago
Unused `searchParams` in `"use cache"` page should not cause dynamic (#75662) When `dynamicIO` is not enabled, and only the standalone `useCache` experimental flag is enabled, we can not encode `searchParams` as hanging promises. To still avoid unused search params from making a page dynamic (due to the `searchParams` being encoded into the cache key), we set them to a promise that resolves to an empty object, while also overwriting the to-be-invoked function for generating a cache entry with a function that creates an erroring `searchParams` prop before invoking the original function. This ensures that used `searchParams` inside of cached functions would still yield an error. closes NAR-85
Author
Parents
Loading