diff --git a/apps/nextjs/src/app/[locale]/boards/_board-hotkeys.tsx b/apps/nextjs/src/app/[locale]/boards/_board-hotkeys.tsx deleted file mode 100644 index ec8ae69a6..000000000 --- a/apps/nextjs/src/app/[locale]/boards/_board-hotkeys.tsx +++ /dev/null @@ -1,8 +0,0 @@ -"use client"; - -import { useBoardHotkeys } from "~/components/board/use-board-hotkeys"; - -export const BoardHotkeys = () => { - useBoardHotkeys(); - return null; -}; diff --git a/apps/nextjs/src/app/[locale]/boards/_layout-creator.tsx b/apps/nextjs/src/app/[locale]/boards/_layout-creator.tsx index b22e45065..9caa5272e 100644 --- a/apps/nextjs/src/app/[locale]/boards/_layout-creator.tsx +++ b/apps/nextjs/src/app/[locale]/boards/_layout-creator.tsx @@ -18,7 +18,7 @@ import type { Params } from "./(content)/_creator"; import { CustomCss } from "./(content)/_custom-css"; import { BoardReadyProvider } from "./(content)/_ready-context"; import { BoardMantineProvider } from "./(content)/_theme"; -import { BoardHotkeys } from "./_board-hotkeys"; +import { BoardHotkeys } from "~/components/board/use-board-hotkeys"; const logger = createLogger({ module: "createBoardLayout" }); diff --git a/apps/nextjs/src/components/board/use-board-hotkeys.ts b/apps/nextjs/src/components/board/use-board-hotkeys.ts index b977c0d43..b94362ca3 100644 --- a/apps/nextjs/src/components/board/use-board-hotkeys.ts +++ b/apps/nextjs/src/components/board/use-board-hotkeys.ts @@ -8,7 +8,16 @@ import { useRequiredBoard } from "@homarr/boards/context"; import { hotkeys } from "@homarr/definitions"; import { useHotkeys } from "@mantine/hooks"; -export const useBoardHotkeys = () => { +/** + * Client component that activates board keyboard shortcuts. + * Render it once inside the board provider tree. + */ +export const BoardHotkeys = () => { + useBoardHotkeys(); + return null; +}; + +const useBoardHotkeys = () => { const router = useRouter(); const currentBoard = useRequiredBoard(); const { data: boards = [] } = clientApi.board.getAllBoards.useQuery();