File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/gitbook/src/components/hooks Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ import React from 'react';
66export 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+ */
105108export function useIsNavigating ( ) {
106109 const { isNavigating : hasBeenClicked } = React . useContext ( NavigationStatusContext ) ;
107110 return hasBeenClicked ;
You can’t perform that action at this time.
0 commit comments