diff --git a/src/features/file-listing/FileRow.tsx b/src/features/file-listing/FileRow.tsx index 71d7133..1355185 100644 --- a/src/features/file-listing/FileRow.tsx +++ b/src/features/file-listing/FileRow.tsx @@ -18,6 +18,7 @@ import { import { FileRowResponsiveGrid } from './FileRowResponsiveGrid'; import { DecryptedAudioFile, deleteFile, ProcessState } from './fileListingSlice'; import { useAppDispatch } from '~/hooks'; +import { AnimationDefinition } from 'framer-motion'; import noCoverFallbackImageURL from '~/assets/no-cover.svg'; interface FileRowProps { @@ -48,15 +49,21 @@ export function FileRow({ id, file }: FileRowProps) { } }; - const handleDeleteRow = useCallback(() => { - onClose(); - setTimeout(() => { + const onCollapseAnimationComplete = (definition: AnimationDefinition) => { + if (definition === 'exit') { dispatch(deleteFile({ id })); - }, 500); - }, [dispatch, id, onClose]); + } + }; return ( - + @@ -111,7 +118,7 @@ export function FileRow({ id, file }: FileRowProps) { )} -