mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
`initialCanonicalUrl` differs from the `canonicalUrl` that gets set on the client, such as when there's a basePath set. This hoists the `canonicalUrl` construction up so we can re-use it when adding refetch markers to the tree. This also renames `pathname` -> `path` since it also includes search params. I added a test to confirm no extra erroneous fetches happened in both cases. Fixes #64584 Closes NEXT-3130
17 lines
241 B
JavaScript
17 lines
241 B
JavaScript
'use client'
|
|
|
|
import { useRouter } from 'next/navigation'
|
|
|
|
export default function Page() {
|
|
const router = useRouter()
|
|
return (
|
|
<button
|
|
onClick={() => {
|
|
router.refresh()
|
|
}}
|
|
>
|
|
Refresh
|
|
</button>
|
|
)
|
|
}
|