react-hotkeys icon indicating copy to clipboard operation
react-hotkeys copied to clipboard

React-hotkeys not working with lazy import

Open MDalprato opened this issue 4 years ago • 0 comments

Describe the bug Hotkeys fires only once and the only way to fire them again it to set the focus on another element.

How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)

Expected behavior Hotkeys events should always works.

Platform (please complete the following information):

  • Version of react-hotkeys (latest)
  • Browser [e.g. chrome, safari] (chrome and safari)
  • OS: [e.g. iOS] (macOS and Windows)

If I import the component using the lazy option the hotkeys action fires only once.

const Test = lazy(() => import("./components/dashboard/Test"));

If I import the component using the 'standard' react options the hotkeys works fine:

import {Test} from "./components/dashboard/Test";

I'm not able to find a solution to this issue.

MDalprato avatar Feb 14 '22 13:02 MDalprato