Add debounce hook (#3524)

* Remove noop
* Add debounce hook
This commit is contained in:
DingDongSoLong4
2023-03-13 04:24:37 +02:00
committed by GitHub
parent 798b3e6dd7
commit bc3730d49f
11 changed files with 180 additions and 181 deletions

View File

@@ -10,7 +10,6 @@ import {
} from "react-bootstrap";
import cx from "classnames";
import Mousetrap from "mousetrap";
import debounce from "lodash-es/debounce";
import { Icon } from "src/components/Shared/Icon";
import { LoadingIndicator } from "src/components/Shared/LoadingIndicator";
@@ -45,6 +44,7 @@ import {
faTimes,
} from "@fortawesome/free-solid-svg-icons";
import { RatingSystem } from "src/components/Shared/Rating/RatingSystem";
import { useDebounce } from "../debounce";
const CLASSNAME = "Lightbox";
const CLASSNAME_HEADER = `${CLASSNAME}-header`;
@@ -197,8 +197,9 @@ export const LightboxComponent: React.FC<IProps> = ({
}
}, [isSwitchingPage, images, index]);
const disableInstantTransition = debounce(
const disableInstantTransition = useDebounce(
() => setInstantTransition(false),
[],
400
);