From feb8c569e12d274c9dc779e6eb91a4a9c8536b97 Mon Sep 17 00:00:00 2001 From: daisy <47104575+linxianxi@users.noreply.github.com> Date: Mon, 19 Jun 2023 14:36:24 +0800 Subject: [PATCH] refactor: Upload ListItem timeout optimization (#42915) --- components/upload/UploadList/ListItem.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/upload/UploadList/ListItem.tsx b/components/upload/UploadList/ListItem.tsx index f7fdd95dd3..53784e4d8b 100644 --- a/components/upload/UploadList/ListItem.tsx +++ b/components/upload/UploadList/ListItem.tsx @@ -82,15 +82,12 @@ const ListItem = React.forwardRef( // Delay to show the progress bar const [showProgress, setShowProgress] = React.useState(false); - const progressRafRef = React.useRef(null); React.useEffect(() => { - progressRafRef.current = setTimeout(() => { + const timer = setTimeout(() => { setShowProgress(true); }, 300); return () => { - if (progressRafRef.current) { - clearTimeout(progressRafRef.current); - } + clearTimeout(timer); }; }, []);