Skip to content

Commit 91116a9

Browse files
committed
fix: lazy load nav button
fixes interaction delay with onClick handlers within Nav (ThemeSwitcher)
1 parent c37f86e commit 91116a9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/Nav/Client/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { BsTranslate } from "react-icons/bs"
77

88
import SearchButton from "@/components/Search/SearchButton"
99
import SearchInputButton from "@/components/Search/SearchInputButton"
10-
import { Button } from "@/components/ui/buttons/Button"
1110
import { Skeleton } from "@/components/ui/skeleton"
1211

1312
import { DESKTOP_LANGUAGE_BUTTON_NAME } from "@/lib/constants"
@@ -18,6 +17,19 @@ import { useThemeToggle } from "../useThemeToggle"
1817
import { useBreakpointValue } from "@/hooks/useBreakpointValue"
1918
import { useTranslation } from "@/hooks/useTranslation"
2019

20+
const Button = dynamic(
21+
() => import("../../ui/buttons/Button").then((mod) => mod.Button),
22+
{
23+
ssr: false,
24+
loading: () => (
25+
<Skeleton
26+
data-label="mobile-menu"
27+
className="mx-3 size-6 px-3 max-md:hidden"
28+
/>
29+
),
30+
}
31+
)
32+
2133
const Menu = dynamic(() => import("../Menu"), {
2234
ssr: false,
2335
loading: () => (

0 commit comments

Comments
 (0)