Skip to content

Commit 5fdd7a3

Browse files
authored
Merge pull request #3004 from tanem/housekeeping
Tidy up comments
2 parents 1269cbe + 097712a commit 5fdd7a3

4 files changed

Lines changed: 7 additions & 18 deletions

File tree

examples/next-app-router/components/NavigationProgress.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ export function useNavigationProgress() {
3030
return context
3131
}
3232

33-
// Watches pathname/searchParams changes to detect when navigation has
34-
// completed. Wrapped in Suspense because useSearchParams() requires a Suspense
35-
// boundary.
33+
// Wrapped in Suspense because useSearchParams() requires a Suspense boundary.
3634
function NavigationComplete({ onComplete }: { onComplete: () => void }) {
3735
const pathname = usePathname()
3836
const searchParams = useSearchParams()
@@ -49,9 +47,8 @@ function NavigationComplete({ onComplete }: { onComplete: () => void }) {
4947
return null
5048
}
5149

52-
// Provides navigation progress state to the component tree. Navigation start is
53-
// signalled via the onNavigate prop on a <ProgressLink>, and completion is
54-
// detected by watching usePathname()/useSearchParams().
50+
// Navigation start is signalled via onNavigate on a <ProgressLink>; completion
51+
// is detected by watching usePathname()/useSearchParams().
5552
export default function NavigationProgress({
5653
children,
5754
}: {

examples/next-app-router/components/ProgressLink.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import Link from 'next/link'
44

55
import { useNavigationProgress } from './NavigationProgress'
66

7-
// A thin wrapper around next/link that signals navigation start via the
8-
// onNavigate callback introduced in Next.js 15.3. Use this in place of <Link>
9-
// wherever you want the progress bar to appear during navigation.
7+
// Uses the onNavigate callback introduced in Next.js 15.3 to signal navigation
8+
// start to <NavigationProgress>.
109
export default function ProgressLink(props: React.ComponentProps<typeof Link>) {
1110
const { start } = useNavigationProgress()
1211

examples/react-router-v6/src/main.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ const Progress: FC<{ isAnimating: boolean }> = ({ isAnimating }) => {
118118
return (
119119
<Container animationDuration={animationDuration} isFinished={isFinished}>
120120
<Bar animationDuration={animationDuration} progress={progress} />
121-
{/*
122-
This example doesn't use a spinner component so the UI stays
123-
tidy. You're free to render whatever is appropriate for your
124-
use-case.
125-
*/}
126121
</Container>
127122
)
128123
}
@@ -135,8 +130,8 @@ const Home = () => {
135130
return (
136131
<>
137132
{/*
138-
Setting a key means that a new NProgress instance is created if
139-
the location is changing, giving us the UI behaviour we want. See:
133+
A key change creates a new NProgress instance, resetting progress
134+
when the location changes. See:
140135
https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key.
141136
*/}
142137
<Progress isAnimating={isLoading} key={location.key} />

test/useGetSetState.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,10 @@ it('should get and set expected state when used in nested functions', () => {
9595
const { result } = setUp({ counter: 0 })
9696
const [get, set] = result.current
9797

98-
// Simulate 3 clicks.
9998
onClick()
10099
onClick()
101100
onClick()
102101

103-
// Fast-forward until all timers have been executed.
104102
act(() => {
105103
jest.runAllTimers()
106104
})

0 commit comments

Comments
 (0)