Navigation Pending State & User Feedback
A navigation can be technically correct and still feel broken if the user receives no feedback.
Current App Router navigation has several layers of feedback:
prefetched destination
β often no visible wait
loading.tsx / Suspense fallback available
β immediate route-level feedback
link navigation still blocked
β useLinkStatus can provide inline pending feedback
The goal is not to show more spinners. The goal is to show the right feedback at the right latency.
Prefer route-level loading architecture firstβ
For a dynamic route:
app/
βββ reports/
βββ loading.tsx
βββ page.tsx
loading.tsx provides a loading boundary for navigation and enables useful partial prefetching behavior.
export default function Loading() {
return <ReportSkeleton />
}
This should be your first navigation-feedback tool when the destination route has server work.
Why?
- the fallback belongs to the route
- shared layouts stay interactive
- navigation can begin before all destination work finishes
- the UI reflects destination structure instead of a generic global spinner
useLinkStatus()β
Stable App Router exposes useLinkStatus from next/link.
'use client'
import { useLinkStatus } from 'next/link'
export function LinkPendingHint() {
const { pending } = useLinkStatus()
return (
<span
aria-hidden
className={pending ? 'link-hint link-hint--pending' : 'link-hint'}
/>
)
}
Use it inside a descendant of the relevant <Link>.
import Link from 'next/link'
import { LinkPendingHint } from './link-pending-hint'
export function ReportsLink() {
return (
<Link href="/reports" prefetch={false}>
Reports <LinkPendingHint />
</Link>
)
}
What pending meansβ
The hook exposes:
{ pending: boolean }
It is useful while that Link navigation is waiting to complete.
Important current behavior:
- it must be rendered beneath a
<Link> - it is especially useful when prefetching is disabled or incomplete
- if the destination is already prefetched, the pending state may be skipped entirely
- when multiple links are clicked rapidly, the most recent navigation is the relevant pending state
Do not build correctness logic around pending becoming visible. Fast navigation may never show it.
Debounce visual feedback, not navigation correctnessβ
A spinner that flashes for 20 ms can make a fast app feel slower.
A useful pattern is a delayed visual treatment:
.link-hint {
opacity: 0;
}
.link-hint--pending {
animation: reveal 0s linear 120ms forwards;
}
@keyframes reveal {
to {
opacity: 1;
}
}
The exact delay is a UX decision. Measure it.
The idea is:
very fast navigation
β no visible indicator
meaningful wait
β subtle feedback appears
Inline feedback vs global progress barβ
Inline link feedback answers:
βDid this specific click register?β
A global progress bar answers:
βIs the application transitioning somewhere?β
Use the smallest scope that communicates the state clearly.
Do not show:
- a button spinner
- a global progress bar
- a route skeleton
- a toast
all for the same ordinary navigation unless the experience genuinely needs multiple layers.
Loading UI should resemble destination structureβ
Generic:
return <p>Loading...</p>
Better for a dashboard:
return (
<section aria-label="Loading reports">
<ReportToolbarSkeleton />
<ReportChartSkeleton />
<ReportTableSkeleton />
</section>
)
A structural skeleton reduces perceived layout shift and tells the user what is arriving.
Avoid fake progressβ
A determinate progress bar like:
67%
implies you know the remaining work.
Most route transitions do not expose a real percentage.
Use indeterminate feedback unless your workflow actually measures progress.
Accessibility of pending feedbackβ
Not every pending hint should be announced.
For a small visual shimmer beside a link:
<span aria-hidden />
may be correct because the user already activated the link and the destination will soon update.
For a long-running operation where the user needs explicit status, use an appropriate status pattern.
<div role="status" aria-live="polite">
Loading reportβ¦
</div>
Do not create noisy live-region announcements on every fast route click.
Preserve interaction when possibleβ
App Router shared layouts can remain interactive during navigation.
Avoid disabling the entire application shell just because one route segment is loading.
Better:
sidebar stays interactive
header stays interactive
page region streams/replaces
instead of:
whole screen blocked by modal spinner
unless the user truly must not interact with the old state.
Route changes as observable client eventsβ
App Router does not use the old Pages Router router.events API.
When client code needs to react to URL changes, compose the current hooks.
'use client'
import { useEffect } from 'react'
import { usePathname, useSearchParams } from 'next/navigation'
export function NavigationObserver() {
const pathname = usePathname()
const searchParams = useSearchParams()
useEffect(() => {
const query = searchParams.toString()
const url = query ? `${pathname}?${query}` : pathname
analytics.pageView(url)
}, [pathname, searchParams])
return null
}
If the containing route can be statically prerendered, the useSearchParams() dependency means this observer should be isolated behind Suspense.
import { Suspense } from 'react'
<Suspense fallback={null}>
<NavigationObserver />
</Suspense>
Analytics: navigation start vs navigation completionβ
Be clear about the event you need.
Possible events:
link clicked
navigation requested
URL changed
route rendered
meaningful content visible
These are not identical.
For analytics page views, the new pathname/search params often represent the useful semantic point.
For UX performance monitoring, you may need separate timing around user intent and visible destination content.
onNavigate for navigation intentβ
A <Link> can observe or interrupt its client navigation:
<Link
href="/checkout"
onNavigate={() => {
analytics.track('checkout_navigation_started')
}}
>
Checkout
</Link>
Remember that onNavigate is scoped to the App Router client navigation, not every possible browser click behavior.
Do not use it as your only site-wide route-change analytics mechanism.
Slow navigation causesβ
The official navigation model suggests several common causes:
Dynamic route with no useful loading boundaryβ
The user may wait for server work before seeing destination feedback.
Slow networkβ
Prefetch may not finish before click.
Prefetch disabledβ
The destination starts later by design.
Large client JavaScriptβ
Links need hydration before some client-side behavior can run. Excessive client bundles can delay responsiveness and prefetch readiness.
Slow server workβ
Navigation UI cannot make an unnecessarily slow data path fast.
Measure server rendering/data work separately.
Navigation performance waterfallβ
user intent
β
link/client handler ready?
β
prefetched payload available?
β
request missing server work
β
loading boundary visible
β
server payload streams/returns
β
client applies transition
β
interactive destination settles
Instrument the stage that matters instead of reporting one vague βnavigation was slowβ metric.
Pending state is not mutation stateβ
A route navigation pending indicator is not the same as a form mutation pending state.
navigation pending
β route transition
mutation pending
β data-changing operation
Later phases cover Server Functions and useActionState/useFormStatus.
Do not conflate them into one global βisLoadingβ boolean.
Navigation interruptionβ
Client navigation can be interruptible. A user may click another route before the first finishes.
Design feedback so stale navigation state does not trap the interface.
Avoid manual state such as:
setGlobalLoading(true)
router.push('/reports')
without a reliable completion/reset model.
Framework-driven loading boundaries and useLinkStatus avoid many of these synchronization bugs.
Common mistakesβ
Global spinner for every routeβ
This hides the benefits of partial route transitions.
Manual isNavigating state that never resetsβ
Interrupted or failed navigation can leave the UI stuck.
Expecting useLinkStatus to always displayβ
A prefetched route may transition too quickly for a pending state.
Treating dev navigation timing as production timingβ
Prefetching and optimization behavior differ.
Announcing every tiny transition through aria-liveβ
This can create accessibility noise.
Debugging checklistβ
If navigation feels frozen:
- Verify whether the destination is static or dynamic.
- Check for a nearby
loading.tsxboundary. - Test a production build.
- Inspect whether the link was prefetched.
- Check server response timing.
- Inspect client bundle/hydration cost.
- Use
useLinkStatusonly where blocked navigation needs immediate feedback. - Verify loading UI disappears correctly when navigation is interrupted.
Interview questionsβ
When should you use useLinkStatus?
For immediate, link-scoped pending feedback when navigation may block because prefetching is disabled, incomplete, or the dynamic route lacks an instant loading path.
Why might pending never visibly become true?
If the destination is already prefetched and navigation completes immediately, the pending state can effectively be skipped.
What replaced router.events in App Router?
Route changes can be observed by composing client hooks such as usePathname() and useSearchParams().
Why are route-level skeletons usually better than a global blocking spinner?
They preserve shared interactive UI, align feedback with the destination, and work with streaming/partial navigation architecture.
Exerciseβ
Create a slow dynamic /reports/[reportId] route and compare three versions:
- no
loading.tsx - route-level
loading.tsx - route-level loading plus a delayed
useLinkStatushint
Test all three with production build and network throttling. Record which stage creates the perceived delay and which feedback improves the experience without adding visual noise.