mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
How was this ever working for dev? In that case, `buildId = "development"` and so it always uses the same cache key
27 lines
436 B
TypeScript
27 lines
436 B
TypeScript
import { Suspense } from 'react'
|
|
import { connection } from 'next/server'
|
|
|
|
async function getData() {
|
|
'use cache'
|
|
|
|
return new Date().toISOString()
|
|
}
|
|
|
|
async function AsyncComp() {
|
|
let data = await getData()
|
|
|
|
return <p id="data">{data}</p>
|
|
}
|
|
|
|
export default async function Home() {
|
|
await connection()
|
|
|
|
return (
|
|
<main>
|
|
<Suspense fallback={<p>Loading...</p>}>
|
|
<AsyncComp />
|
|
</Suspense>
|
|
</main>
|
|
)
|
|
}
|