From 097712af03a67e429759d1eeb5dcf10dd576cebf Mon Sep 17 00:00:00 2001 From: Tane Morgan <464864+tanem@users.noreply.github.com> Date: Sat, 21 Feb 2026 05:59:15 +1300 Subject: [PATCH] Tidy up comments --- .../next-app-router/components/NavigationProgress.tsx | 9 +++------ examples/next-app-router/components/ProgressLink.tsx | 5 ++--- examples/react-router-v6/src/main.tsx | 9 ++------- test/useGetSetState.spec.ts | 2 -- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/examples/next-app-router/components/NavigationProgress.tsx b/examples/next-app-router/components/NavigationProgress.tsx index 286dff135..42c19ebe8 100644 --- a/examples/next-app-router/components/NavigationProgress.tsx +++ b/examples/next-app-router/components/NavigationProgress.tsx @@ -30,9 +30,7 @@ export function useNavigationProgress() { return context } -// Watches pathname/searchParams changes to detect when navigation has -// completed. Wrapped in Suspense because useSearchParams() requires a Suspense -// boundary. +// Wrapped in Suspense because useSearchParams() requires a Suspense boundary. function NavigationComplete({ onComplete }: { onComplete: () => void }) { const pathname = usePathname() const searchParams = useSearchParams() @@ -49,9 +47,8 @@ function NavigationComplete({ onComplete }: { onComplete: () => void }) { return null } -// Provides navigation progress state to the component tree. Navigation start is -// signalled via the onNavigate prop on a , and completion is -// detected by watching usePathname()/useSearchParams(). +// Navigation start is signalled via onNavigate on a ; completion +// is detected by watching usePathname()/useSearchParams(). export default function NavigationProgress({ children, }: { diff --git a/examples/next-app-router/components/ProgressLink.tsx b/examples/next-app-router/components/ProgressLink.tsx index a10577ff6..cc9ca9421 100644 --- a/examples/next-app-router/components/ProgressLink.tsx +++ b/examples/next-app-router/components/ProgressLink.tsx @@ -4,9 +4,8 @@ import Link from 'next/link' import { useNavigationProgress } from './NavigationProgress' -// A thin wrapper around next/link that signals navigation start via the -// onNavigate callback introduced in Next.js 15.3. Use this in place of -// wherever you want the progress bar to appear during navigation. +// Uses the onNavigate callback introduced in Next.js 15.3 to signal navigation +// start to . export default function ProgressLink(props: React.ComponentProps) { const { start } = useNavigationProgress() diff --git a/examples/react-router-v6/src/main.tsx b/examples/react-router-v6/src/main.tsx index 4d89a1313..5f23c0ff5 100644 --- a/examples/react-router-v6/src/main.tsx +++ b/examples/react-router-v6/src/main.tsx @@ -118,11 +118,6 @@ const Progress: FC<{ isAnimating: boolean }> = ({ isAnimating }) => { return ( - {/* - This example doesn't use a spinner component so the UI stays - tidy. You're free to render whatever is appropriate for your - use-case. - */} ) } @@ -135,8 +130,8 @@ const Home = () => { return ( <> {/* - Setting a key means that a new NProgress instance is created if - the location is changing, giving us the UI behaviour we want. See: + A key change creates a new NProgress instance, resetting progress + when the location changes. See: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key. */} diff --git a/test/useGetSetState.spec.ts b/test/useGetSetState.spec.ts index 208882a94..66985f864 100644 --- a/test/useGetSetState.spec.ts +++ b/test/useGetSetState.spec.ts @@ -95,12 +95,10 @@ it('should get and set expected state when used in nested functions', () => { const { result } = setUp({ counter: 0 }) const [get, set] = result.current - // Simulate 3 clicks. onClick() onClick() onClick() - // Fast-forward until all timers have been executed. act(() => { jest.runAllTimers() })