Skip to content

Commit 28224c5

Browse files
authored
Merge pull request #16 from taehallm/main
fix: resolve React element type errors in DropdownMenuTrigger
2 parents 59bf26c + 73c8a6a commit 28224c5

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

components/DropdownMenuTrigger.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ function DropdownMenuTrigger({ children, items, hotkey }: DropdownMenuTriggerPro
9090
};
9191
}, [open]);
9292

93+
// Handle lazy-loaded components - this is the key fix
94+
if (!children || children.type === undefined || (children as any)._payload) {
95+
return null;
96+
}
97+
9398
const element = open
9499
? createPortal(
95100
<OutsideElementEvent onOutsideEvent={onOutsideEvent}>

modules/hotkeys/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Vendored from
33
// https://github.com/JohannesKlauss/react-hotkeys-hook/blob/main/src/index.ts
44

5-
import useHotkeys from '@modules/hotkeys/use-hotkeys'
5+
import useHotkeysDefault from '@modules/hotkeys/use-hotkeys'
66
import type { Options, Keys, HotkeyCallback } from '@modules/hotkeys/types'
77
import { HotkeysProvider, useHotkeysContext } from '@modules/hotkeys/hotkeys-provider'
88
import { isHotkeyPressed } from '@modules/hotkeys/is-hotkey-pressed'
9-
import useRecordHotkeys from '@modules/hotkeys/use-record-hotkeys'
9+
import useRecordHotkeysDefault from '@modules/hotkeys/use-record-hotkeys'
1010

1111
export {
12-
useHotkeys,
13-
useRecordHotkeys,
12+
useHotkeysDefault as useHotkeys,
13+
useRecordHotkeysDefault as useRecordHotkeys,
1414
useHotkeysContext,
1515
isHotkeyPressed,
1616
HotkeysProvider,

0 commit comments

Comments
 (0)