mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Server-side part of #94773. We remove previously added code that excludes root params from the ShellStatic stage and let them resolve there. We also add some special cases for `params` objects that consist entirely of root params - those are allowed to resolve as well.
26 lines
484 B
TypeScript
26 lines
484 B
TypeScript
'use client'
|
|
|
|
import Link, { useLinkStatus } from 'next/link'
|
|
import { ComponentProps } from 'react'
|
|
|
|
export function LinkWithPendingIndicator({
|
|
children,
|
|
...props
|
|
}: ComponentProps<typeof Link>) {
|
|
return (
|
|
<Link {...props}>
|
|
{children} <PendingIndicator />
|
|
</Link>
|
|
)
|
|
}
|
|
|
|
function PendingIndicator() {
|
|
const { pending } = useLinkStatus()
|
|
if (!pending) return null
|
|
return (
|
|
<span data-pending style={{ color: 'gray' }}>
|
|
Pending...
|
|
</span>
|
|
)
|
|
}
|