diff --git a/packages/docusaurus-theme-classic/src/theme-classic.d.ts b/packages/docusaurus-theme-classic/src/theme-classic.d.ts index c0461fd614ce..0ecc1e22373c 100644 --- a/packages/docusaurus-theme-classic/src/theme-classic.d.ts +++ b/packages/docusaurus-theme-classic/src/theme-classic.d.ts @@ -202,18 +202,6 @@ declare module '@theme/hooks/useHideableNavbar' { export default useHideableNavbar; } -declare module '@theme/hooks/useLocationHash' { - import type {Dispatch, SetStateAction} from 'react'; - - export type useLocationHashReturns = readonly [ - string, - Dispatch>, - ]; - - const useLocationHash: (initialHash: string) => useLocationHashReturns; - export default useLocationHash; -} - declare module '@theme/hooks/useLockBodyScroll' { const useLockBodyScroll: (lock?: boolean) => void; export default useLockBodyScroll; diff --git a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx index 456262c90234..770f86bd37bd 100644 --- a/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx +++ b/packages/docusaurus-theme-classic/src/theme/NavbarItem/DropdownNavbarItem.tsx @@ -55,7 +55,6 @@ function DropdownNavbarItemDesktop({ ...props }: DesktopOrMobileNavBarItemProps) { const dropdownRef = useRef(null); - const dropdownMenuRef = useRef(null); const [showDropdown, setShowDropdown] = useState(false); useEffect(() => { @@ -98,7 +97,7 @@ function DropdownNavbarItemDesktop({ }}> {props.children ?? props.label} -
    +
      {items.map((childItemProps, i) => ( { - const handleHashChange = () => setHash(window.location.hash); - - window.addEventListener('hashchange', handleHashChange); - - return () => window.removeEventListener('hashchange', handleHashChange); - }, []); - - return [hash, setHash]; -} - -export default useLocationHash;