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

This commit is contained in:
HouKunLin 2023-05-17 09:10:36 +08:00
parent b8c3a51756
commit eaf05d8cbb
1 changed files with 3 additions and 3 deletions

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%' }}>