You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: packages/next/errors.json
+2-1
Original file line number
Diff line number
Diff line change
@@ -631,5 +631,6 @@
631
631
"630": "Invariant (SlowModuleDetectionPlugin): Module is recorded after the report is generated. This is a Next.js internal bug.",
632
632
"631": "Invariant (SlowModuleDetectionPlugin): Circular dependency detected in module graph. This is a Next.js internal bug.",
633
633
"632": "Invariant (SlowModuleDetectionPlugin): Module is missing a required debugId. This is a Next.js internal bug.",
634
-
"633": "Dynamic route not found"
634
+
"633": "Dynamic route not found",
635
+
"634": "Route %s used \"searchParams\" inside \"use cache\". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use \"searchParams\" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache"
0 commit comments