mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
refactor: Upload ListItem timeout optimization (#42915)
This commit is contained in:
parent
8a4203bec8
commit
feb8c569e1
@ -82,15 +82,12 @@ const ListItem = React.forwardRef(
|
|||||||
|
|
||||||
// Delay to show the progress bar
|
// Delay to show the progress bar
|
||||||
const [showProgress, setShowProgress] = React.useState(false);
|
const [showProgress, setShowProgress] = React.useState(false);
|
||||||
const progressRafRef = React.useRef<NodeJS.Timer | null>(null);
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
progressRafRef.current = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setShowProgress(true);
|
setShowProgress(true);
|
||||||
}, 300);
|
}, 300);
|
||||||
return () => {
|
return () => {
|
||||||
if (progressRafRef.current) {
|
clearTimeout(timer);
|
||||||
clearTimeout(progressRafRef.current);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user