mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
When checking which segment(s) need to be refreshed, we currently compare the current page URL with the segment's refresh marker. We should inspect the `mutable.canonicalUrl` value first since that's the URL we're changing to, followed by `state.canonicalUrl` as a fallback (indicating that there's no URL change pending). This is because the server action handler will receive a redirect URL prior to `location.pathname` being updated, so the router will incorrectly think it needs to refresh the data for the page we're going to. Closes NEXT-3500
31 lines
920 B
TypeScript
31 lines
920 B
TypeScript
import Link from 'next/link'
|
|
import { clearData, getData } from './actions'
|
|
|
|
export default async function Home() {
|
|
const data = await getData()
|
|
const randomNumber = await fetch(
|
|
'https://next-data-api-endpoint.vercel.app/api/random'
|
|
).then((res) => res.text())
|
|
|
|
return (
|
|
<div id="root-page">
|
|
<Link href="/revalidate-modal">Open Revalidate Modal</Link>
|
|
<Link href="/refresh-modal">Open Refresh Modal</Link>
|
|
<Link href="/redirect-modal">Open Redirect Modal</Link>
|
|
<Link href="/detail-page">Intercepted Detail Page</Link>
|
|
<div id="random-number">{randomNumber}</div>
|
|
<form action={clearData}>
|
|
<button id="clear-entries">Clear Entries</button>
|
|
</form>
|
|
<div>
|
|
<h1>Current Data</h1>
|
|
<ul id="entries">
|
|
{data.map((item, index) => (
|
|
<li key={index}>{item}</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|