mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-24 00:02:16 +00:00
feat: 删除歌曲行数据时改用 onClose 来处理
This commit is contained in:
parent
8a825affd0
commit
0197c8b2f4
@ -25,7 +25,7 @@ interface FileRowProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function FileRow({ id, file }: FileRowProps) {
|
export function FileRow({ id, file }: FileRowProps) {
|
||||||
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: true });
|
const { isOpen, onClose } = useDisclosure({ defaultIsOpen: true });
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const isDecrypted = file.state === ProcessState.COMPLETE;
|
const isDecrypted = file.state === ProcessState.COMPLETE;
|
||||||
|
|
||||||
@ -47,11 +47,11 @@ export function FileRow({ id, file }: FileRowProps) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleDeleteRow = useCallback(() => {
|
const handleDeleteRow = useCallback(() => {
|
||||||
onToggle();
|
onClose();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(deleteFile({ id }));
|
dispatch(deleteFile({ id }));
|
||||||
}, 500);
|
}, 500);
|
||||||
}, [dispatch, id, onToggle]);
|
}, [dispatch, id, onClose]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Collapse in={isOpen} animateOpacity unmountOnExit startingHeight={0} style={{ width: '100%' }}>
|
<Collapse in={isOpen} animateOpacity unmountOnExit startingHeight={0} style={{ width: '100%' }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user