Skip to content

Commit 0a63d53

Browse files
committed
update comment
1 parent 14c7ff2 commit 0a63d53

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/gitbook/src/components/hooks/useHash.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import React from 'react';
66
export const NavigationStatusContext = React.createContext<{
77
hash: string | null;
88
/**
9-
* Updates the hash value from the URL provided here.
10-
* It will then be used by the `useHash` hook.
9+
* Updates the navigation state from the URL provided here.
1110
* URL can be relative or absolute.
1211
*/
1312
onNavigationClick: (href: string) => void;
@@ -90,7 +89,7 @@ export const NavigationStatusProvider: React.FC<React.PropsWithChildren> = ({ ch
9089
};
9190

9291
/**
93-
* Hook to get the current hash from the URL and click state.
92+
* Hook to get the current hash from the URL.
9493
* @see https://github.com/vercel/next.js/discussions/49465
9594
* We use a different hack than this one, because for same page link it don't work
9695
* We can't use the `hashChange` event because it doesn't fire for `replaceState` and `pushState` which are used by Next.js.
@@ -102,6 +101,10 @@ export function useHash() {
102101
return hash;
103102
}
104103

104+
/**
105+
* Hook to get the current navigation state.
106+
* @returns True if a navigation has been triggered recently. False otherwise, it also resets to false when the navigation is complete.
107+
*/
105108
export function useIsNavigating() {
106109
const { isNavigating: hasBeenClicked } = React.useContext(NavigationStatusContext);
107110
return hasBeenClicked;

0 commit comments

Comments
 (0)