Add no-misused/floating-promises lint rule

This commit is contained in:
Fedor Indutny 2022-12-21 10:41:48 -08:00 committed by GitHub
parent 1a68c3db62
commit ed271d92ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
150 changed files with 1296 additions and 991 deletions

View file

@ -14,7 +14,7 @@ import { Button, ButtonVariant } from '../Button';
export type OwnProps = {
readonly onClose?: () => unknown;
readonly closeStickerPackPreview: (packId: string) => unknown;
readonly closeStickerPackPreview: () => unknown;
readonly downloadStickerPack: (
packId: string,
packKey: string,
@ -107,9 +107,18 @@ export const StickerPreviewModal = React.memo(function StickerPreviewModalInner(
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
React.useEffect(() => {
if (pack) {
return;
}
// Pack fully uninstalled, don't keep the modal open
closeStickerPackPreview();
}, [pack, closeStickerPackPreview]);
const handleClose = React.useCallback(() => {
if (pack?.id) {
closeStickerPackPreview(pack.id);
if (pack) {
closeStickerPackPreview();
}
onClose?.();
}, [closeStickerPackPreview, onClose, pack]);