mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +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
|
||||
const [showProgress, setShowProgress] = React.useState(false);
|
||||
const progressRafRef = React.useRef<NodeJS.Timer | null>(null);
|
||||
React.useEffect(() => {
|
||||
progressRafRef.current = setTimeout(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setShowProgress(true);
|
||||
}, 300);
|
||||
return () => {
|
||||
if (progressRafRef.current) {
|
||||
clearTimeout(progressRafRef.current);
|
||||
}
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user