feat: 删除歌曲行数据时改用 onClose 来处理

This commit is contained in:
HouKunLin 2023-05-17 09:10:36 +08:00
parent 8a825affd0
commit 0197c8b2f4

View File

@ -25,7 +25,7 @@ interface FileRowProps {
}
export function FileRow({ id, file }: FileRowProps) {
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: true });
const { isOpen, onClose } = useDisclosure({ defaultIsOpen: true });
const dispatch = useAppDispatch();
const isDecrypted = file.state === ProcessState.COMPLETE;
@ -47,11 +47,11 @@ export function FileRow({ id, file }: FileRowProps) {
}, []);
const handleDeleteRow = useCallback(() => {
onToggle();
onClose();
setTimeout(() => {
dispatch(deleteFile({ id }));
}, 500);
}, [dispatch, id, onToggle]);
}, [dispatch, id, onClose]);
return (
<Collapse in={isOpen} animateOpacity unmountOnExit startingHeight={0} style={{ width: '100%' }}>