Unverified Commit c4608008 authored by Aurora Scharff's avatar Aurora Scharff Committed by GitHub

Add client fixes for fully static route errors (#99659)

## Summary

- add a Client fix to both runtime-data and uncached-data errors on
fully static routes
- document client URL hooks, browser APIs such as non-`HttpOnly`
cookies, and client-side fetching as distinct patterns
- keep the combined runtime-or-uncached classification in the blocking
build message instead of adding a third overlay card variant
- omit the Cache card when a fully static error points to
`connection()`, matching the existing blocking-route behavior
- align build guidance, overlay cards, error pages, and tests

## Design and capture review

- [Runtime
data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/125-ensure-static-cookies)
- [Uncached
data](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/128-ensure-static-uncached)
-
[`connection()`](https://error-messages-overhaul-ibsl.labs.vercel.dev/scenario/129-ensure-static-connection)

## Verification

- `pnpm exec jest --runInBand
packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.test.ts
packages/next/src/next-devtools/dev-overlay/container/errors.test.ts`
(139 tests passed)
- Prettier and ESLint passed for the changed files
- Focused e2e snapshots left to CI

<!-- NEXT_JS_LLM -->
parent 7bb6730b
...@@ -51,6 +51,19 @@ Request-specific reads from [`cookies()`](/docs/app/api-reference/functions/cook ...@@ -51,6 +51,19 @@ Request-specific reads from [`cookies()`](/docs/app/api-reference/functions/cook
{ text: ' return <Content />' }, { text: ' return <Content />' },
]} ]}
/> />
<FixCard
group="client"
title="Read the data on the client"
href="#read-the-data-on-the-client"
snippets={[
{ text: "'use client'" },
{
text: "const { data } = useSWR('/api', fetcher)",
highlight: true,
},
{ text: 'return <Content data={data} />' },
]}
/>
</FixCardGrid> </FixCardGrid>
## Cache the data ## Cache the data
...@@ -113,6 +126,44 @@ Every visitor receives the same output because the removed operation no longer r ...@@ -113,6 +126,44 @@ Every visitor receives the same output because the removed operation no longer r
- Other uncached or runtime data in the route, including layouts and metadata, must also be resolved. - Other uncached or runtime data in the route, including layouts and metadata, must also be resolved.
- If the operation must run for each request, first confirm that request-time rendering is intended for the entire route. See [Remove the static requirement](#remove-the-static-requirement). - If the operation must run for each request, first confirm that request-time rendering is intended for the entire route. See [Remove the static requirement](#remove-the-static-requirement).
## Read the data on the client
Choose this fix when the data can load in the browser after the static output renders.
### Patterns
#### Fetch in a Client Component
Move the request to a Client Component. A client data-fetching library can provide loading states, caching, and revalidation in the browser:
```tsx filename="app/recommendations.tsx"
'use client'
import useSWR from 'swr'
const fetcher = (url: string) => fetch(url).then((response) => response.json())
export default function Recommendations() {
const { data, error, isLoading } = useSWR('/api/recommendations', fetcher)
if (error) return <p>Failed to load recommendations.</p>
if (isLoading) return <p>Loading recommendations...</p>
return <p>{data.summary}</p>
}
```
Learn more: [Client-side data fetching](/docs/app/guides/client-side-data-fetching).
### Trade-off
The prerender does not include this data, and the browser makes an additional request after hydration.
### Gotchas
- Protect the API endpoint with the same authorization checks as the original server-side data access.
- This pattern adds a client-side request. Prefer [caching the server data](#cache-the-data) when visitors can share the result.
## Verifying the fix ## Verifying the fix
After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax the fully static requirement. After applying a fix, rerun [`next build`](/docs/app/api-reference/cli/next#next-build-options) and confirm that the route completes prerendering. If the error also appeared in [`next dev`](/docs/app/api-reference/cli/next#next-dev-options), reload the route and confirm that the overlay clears. Wrapping the operation in Suspense or setting `instant = false` does not relax the fully static requirement.
......
...@@ -43,12 +43,12 @@ Uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fet ...@@ -43,12 +43,12 @@ Uncached [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fet
/> />
<FixCard <FixCard
group="client" group="client"
title="Read search parameters on the client" title="Read the data on the client"
href="#read-search-parameters-on-the-client" href="#read-the-data-on-the-client"
snippets={[ snippets={[
{ text: "'use client'" }, { text: "'use client'" },
{ text: 'const params = useSearchParams()', highlight: true }, { text: "use(browser('Read cookie'))", highlight: true },
{ text: "return <p>{params.get('q')}</p>" }, { text: 'const cart = document.cookie.match(/cart=(\\d+)/)' },
]} ]}
/> />
</FixCardGrid> </FixCardGrid>
...@@ -79,15 +79,15 @@ Every visitor receives the same value because the route no longer reads request- ...@@ -79,15 +79,15 @@ Every visitor receives the same value because the route no longer reads request-
- This fix applies to `cookies()`, `headers()`, and other removable reads. It does not provide replacement values when the content must vary by request. - This fix applies to `cookies()`, `headers()`, and other removable reads. It does not provide replacement values when the content must vary by request.
## Read search parameters on the client ## Read the data on the client
Choose this fix when only browser UI needs the query string. Choose this fix when the browser can read the value and the server does not need it to produce static output.
### Patterns ### Patterns
#### Read the query string in a Client Component #### Read URL data in a Client Component
Use [`useSearchParams()`](/docs/app/api-reference/functions/use-search-params) instead of the page's server-side `searchParams` prop: Use [`useSearchParams()`](/docs/app/api-reference/functions/use-search-params) for the query string or [`useParams()`](/docs/app/api-reference/functions/use-params) for route parameters. If the hook suspends during prerendering, render the Client Component inside [`Suspense`](https://react.dev/reference/react/Suspense) so the prerender can include its fallback.
```jsx filename="app/search/query.jsx" ```jsx filename="app/search/query.jsx"
'use client' 'use client'
...@@ -100,19 +100,36 @@ export default function Query() { ...@@ -100,19 +100,36 @@ export default function Query() {
} }
``` ```
Learn more: [`useSearchParams()`](/docs/app/api-reference/functions/use-search-params). Learn more: [`useSearchParams`](/docs/app/api-reference/functions/use-search-params).
Render the Client Component inside [`Suspense`](https://react.dev/reference/react/Suspense). Do not pass the server's `searchParams` promise to it. #### Read browser data
For data available through browser APIs, such as a non-`HttpOnly` cookie, call [`use(browser())`](/docs/app/guides/single-page-applications#rendering-components-only-in-the-browser) before reading the value. During prerendering, the component suspends and its nearest `<Suspense>` boundary renders a fallback.
```jsx filename="app/cart-count.jsx"
'use client'
import { use } from 'react'
import { browser } from 'react-dom'
export default function CartCount() {
use(browser('The cart count is stored in a cookie.'))
const match = document.cookie.match(/(?:^|; )cart-count=(\d+)/)
return <p>Cart ({Number(match?.[1] ?? 0)})</p>
}
```
Learn more: [Rendering components only in the browser](/docs/app/guides/single-page-applications#rendering-components-only-in-the-browser).
### Trade-off ### Trade-off
The prerender includes the fallback, and the query-dependent UI renders in the browser. The prerender includes the nearest fallback. The request-specific UI appears after the browser loads and renders the Client Component.
### Gotchas ### Gotchas
- Adding `'use client'` alone does not fix this error. Remove the server-side read and use the client hook. - Adding `'use client'` alone does not fix this error because Client Components are also prerendered. Use a client hook that suspends or call `use(browser())` before reading a browser API.
- Do not pass the server's `searchParams` promise to the Client Component. - Do not pass the server's `params` or `searchParams` promise to the Client Component. Read URL data with the client hooks instead.
- This fix applies only to `searchParams`. It does not replace cookies, headers, or route parameters. - The browser cannot read `HttpOnly` cookies or arbitrary request headers. Keep sensitive data in `HttpOnly` cookies and choose another fix when the browser cannot access the value safely.
## Other options ## Other options
......
...@@ -696,16 +696,16 @@ const staticRouteRuntimeCards: FixCard[] = [ ...@@ -696,16 +696,16 @@ const staticRouteRuntimeCards: FixCard[] = [
link: 'https://nextjs.org/docs/messages/static-route-runtime#remove-the-data-access', link: 'https://nextjs.org/docs/messages/static-route-runtime#remove-the-data-access',
}, },
{ {
id: 'read-search-parameters-on-the-client', id: 'read-the-data-on-the-client',
title: 'Read search parameters on the client', title: 'Read the data on the client',
group: 'client', group: 'client',
snippets: [ snippets: [
{ text: "'use client'" }, { text: "'use client'" },
{ text: 'const params = useSearchParams()', highlight: true }, { text: "use(browser('Read cookie'))", highlight: true },
{ text: "return <p>{params.get('q')}</p>" }, { text: 'document.cookie.match(/cart=/)' },
], ],
copyable: true, copyable: true,
link: 'https://nextjs.org/docs/messages/static-route-runtime#read-search-parameters-on-the-client', link: 'https://nextjs.org/docs/messages/static-route-runtime#read-the-data-on-the-client',
}, },
] ]
...@@ -741,6 +741,18 @@ const staticRouteDynamicCards: FixCard[] = [ ...@@ -741,6 +741,18 @@ const staticRouteDynamicCards: FixCard[] = [
copyable: true, copyable: true,
link: 'https://nextjs.org/docs/messages/static-route-dynamic#remove-the-data-access', link: 'https://nextjs.org/docs/messages/static-route-dynamic#remove-the-data-access',
}, },
{
id: 'read-the-data-on-the-client',
title: 'Read the data on the client',
group: 'client',
snippets: [
{ text: "'use client'" },
{ text: "const data = useSWR('/api')", highlight: true },
{ text: 'return <Content data={data} />' },
],
copyable: true,
link: 'https://nextjs.org/docs/messages/static-route-dynamic#read-the-data-on-the-client',
},
] ]
const staticMetadataRuntimeCards: FixCard[] = [ const staticMetadataRuntimeCards: FixCard[] = [
{ {
...@@ -1042,17 +1054,17 @@ export function getCards( ...@@ -1042,17 +1054,17 @@ export function getCards(
case 'static-viewport': case 'static-viewport':
return variant === 'runtime' return variant === 'runtime'
? staticViewportRuntimeCards ? staticViewportRuntimeCards
: staticViewportDynamicCards : filterCacheForConnection(staticViewportDynamicCards, variant, cause)
case 'static-metadata': case 'static-metadata':
return variant === 'runtime' return variant === 'runtime'
? staticMetadataRuntimeCards ? staticMetadataRuntimeCards
: staticMetadataDynamicCards : filterCacheForConnection(staticMetadataDynamicCards, variant, cause)
case 'static-route': case 'static-route':
return variant === 'runtime' return variant === 'runtime'
? staticRouteRuntimeCards ? staticRouteRuntimeCards
: staticRouteDynamicCards : filterCacheForConnection(staticRouteDynamicCards, variant, cause)
case 'blocking-route': { case 'blocking-route': {
switch (variant) { switch (variant) {
......
...@@ -831,17 +831,17 @@ describe('fully static route errors', () => { ...@@ -831,17 +831,17 @@ describe('fully static route errors', () => {
}) })
it.each(['static-route', 'static-metadata', 'static-viewport'] as const)( it.each(['static-route', 'static-metadata', 'static-viewport'] as const)(
'does not infer card filtering from the code frame for %s', 'filters the cache card for connection() in %s',
(kind) => { (kind) => {
const cause = deriveCauseFromCodeFrame( const cause = deriveCauseFromCodeFrame(
kind, kind,
'dynamic', 'dynamic',
'> 4 | await connection()' '> 4 | await connection()'
) )
expect(cause).toBeUndefined() expect(cause).toBe('connection')
expect(getCards(kind, 'dynamic', cause)).toEqual( expect(
getCards(kind, 'dynamic') getCards(kind, 'dynamic', cause).map((card) => card.group)
) ).not.toContain('cache')
} }
) )
}) })
...@@ -284,7 +284,14 @@ export function deriveCauseFromCodeFrame( ...@@ -284,7 +284,14 @@ export function deriveCauseFromCodeFrame(
codeFrame: string | null | undefined codeFrame: string | null | undefined
): 'connection' | undefined { ): 'connection' | undefined {
if (variant !== 'dynamic') return undefined if (variant !== 'dynamic') return undefined
if (kind !== 'blocking-route' && kind !== 'metadata' && kind !== 'viewport') if (
kind !== 'blocking-route' &&
kind !== 'metadata' &&
kind !== 'viewport' &&
kind !== 'static-route' &&
kind !== 'static-metadata' &&
kind !== 'static-viewport'
)
return undefined return undefined
if (!codeFrame) return undefined if (!codeFrame) return undefined
for (const line of stripAnsi(codeFrame).split('\n')) { for (const line of stripAnsi(codeFrame).split('\n')) {
......
...@@ -218,7 +218,7 @@ export function createRuntimeBodyErrorInStaticRoute(route: string): Error { ...@@ -218,7 +218,7 @@ export function createRuntimeBodyErrorInStaticRoute(route: string): Error {
`This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache prevents it from being fully prerendered.\n\n` + `This route is configured to be fully static, but runtime data from \`cookies()\`, \`headers()\`, \`params\`, \`searchParams\`, or a short-lived cache prevents it from being fully prerendered.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [remove] Remove the data access\n` + ` - [remove] Remove the data access\n` +
` - [client] Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\`\n\n` + ` - [client] Read the data on the client\n\n` +
`Learn more: https://nextjs.org/docs/messages/static-route-runtime` `Learn more: https://nextjs.org/docs/messages/static-route-runtime`
) )
} }
...@@ -229,7 +229,8 @@ export function createDynamicBodyErrorInStaticRoute(route: string): Error { ...@@ -229,7 +229,8 @@ export function createDynamicBodyErrorInStaticRoute(route: string): Error {
`This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` prevents it from being fully prerendered.\n\n` + `This route is configured to be fully static, but an uncached \`fetch(...)\`, database call, or \`connection()\` prevents it from being fully prerendered.\n\n` +
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] Cache the data access with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [remove] Remove the data access\n\n` + ` - [remove] Remove the data access\n` +
` - [client] Read the data on the client\n\n` +
`Learn more: https://nextjs.org/docs/messages/static-route-dynamic` `Learn more: https://nextjs.org/docs/messages/static-route-dynamic`
) )
} }
...@@ -243,7 +244,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute( ...@@ -243,7 +244,7 @@ export function createNonPrerenderableBodyErrorInStaticRoute(
`Ways to fix this:\n` + `Ways to fix this:\n` +
` - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)\n` + ` - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)\n` +
` - [remove] Remove the data access\n` + ` - [remove] Remove the data access\n` +
` - Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\`\n\n` + ` - [client] Read the data on the client\n\n` +
`Learn more: https://nextjs.org/docs/messages/static-route-dynamic` `Learn more: https://nextjs.org/docs/messages/static-route-dynamic`
) )
} }
......
...@@ -233,7 +233,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -233,7 +233,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/uncached-data/page.tsx:15:16) at Inner (app/default/uncached-data/page.tsx:15:16)
...@@ -288,7 +288,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -288,7 +288,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/connection/page.tsx:17:19) at Inner (app/default/connection/page.tsx:17:19)
...@@ -343,7 +343,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -343,7 +343,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/instant-false/connection-blocking/page.tsx:20:19) at Inner (app/default/instant-false/connection-blocking/page.tsx:20:19)
...@@ -398,7 +398,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -398,7 +398,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/suspense-above-body/connection-blocking/page.tsx:20:19) at Inner (app/suspense-above-body/connection-blocking/page.tsx:20:19)
...@@ -453,7 +453,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -453,7 +453,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at UseServerData (app/default/dynamic-data-passed-to-client/client.tsx:6:19) at UseServerData (app/default/dynamic-data-passed-to-client/client.tsx:6:19)
...@@ -936,7 +936,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -936,7 +936,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/excluded-caches/non-prerenderable-cache/page.tsx:17:9) at Inner (app/default/excluded-caches/non-prerenderable-cache/page.tsx:17:9)
...@@ -1207,7 +1207,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1207,7 +1207,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/mixed-server-client/connection-and-browser/page.tsx:21:19) at Inner (app/default/mixed-server-client/connection-and-browser/page.tsx:21:19)
...@@ -1263,7 +1263,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1263,7 +1263,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/mixed-server-client/connection-and-use-search-params/page.tsx:21:19) at Inner (app/default/mixed-server-client/connection-and-use-search-params/page.tsx:21:19)
...@@ -1345,7 +1345,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1345,7 +1345,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at Inner (app/default/mixed-server-client/connection-and-use-io/page.tsx:21:19) at Inner (app/default/mixed-server-client/connection-and-use-io/page.tsx:21:19)
...@@ -1365,7 +1365,7 @@ describe('ensureStatic = "navigation"', () => { ...@@ -1365,7 +1365,7 @@ describe('ensureStatic = "navigation"', () => {
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at ClientIO (app/default/mixed-server-client/connection-and-use-io/client.tsx:6:6) at ClientIO (app/default/mixed-server-client/connection-and-use-io/client.tsx:6:6)
......
...@@ -1438,7 +1438,7 @@ export function registerHeadAndReportingTests( ...@@ -1438,7 +1438,7 @@ export function registerHeadAndReportingTests(
Ways to fix this: Ways to fix this:
- [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`) - [cache] For uncached data (\`fetch\`, database calls): cache the access with \`"use cache"\` (does not apply to \`connection()\`)
- [remove] Remove the data access - [remove] Remove the data access
- Only applies to \`searchParams\`: read them on the client with \`useSearchParams()\` - [client] Read the data on the client
Learn more: https://nextjs.org/docs/messages/static-route-dynamic Learn more: https://nextjs.org/docs/messages/static-route-dynamic
at main (<anonymous>) at main (<anonymous>)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment