From 5e931e50a53994fb05794db2bc00e2e9bef757e5 Mon Sep 17 00:00:00 2001 From: oiov Date: Sun, 6 Jul 2025 22:56:48 +0800 Subject: [PATCH] fixup build error --- components/file/file-list.tsx | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/components/file/file-list.tsx b/components/file/file-list.tsx index d71f0fa..b54c40c 100644 --- a/components/file/file-list.tsx +++ b/components/file/file-list.tsx @@ -158,25 +158,10 @@ export default function UserFileList({ } }; - if (files?.total === 0) { - return ( - - - {t("No Files")} - - {t("You don't upload any files yet")} - - - ); - } - - useEffect(() => { - handleGetFileShortLinkByIds(); - }, [files]); - const handleGetFileShortLinkByIds = async () => { + if (!files || !files.list) return; try { - const ids = files?.list.map((f) => f.shortUrlId || ""); + const ids = files.list.map((f) => f.shortUrlId || ""); if (!ids?.some((id) => id !== "")) return; const response = await fetch(`${action}/r2/short`, { method: "POST", @@ -192,6 +177,22 @@ export default function UserFileList({ } }; + useEffect(() => { + handleGetFileShortLinkByIds(); + }, [files]); + + if (files?.total === 0) { + return ( + + + {t("No Files")} + + {t("You don't upload any files yet")} + + + ); + } + const renderListView = () => (