From d9956e6dbd0e1309bb972a1d417d38266c69b45e Mon Sep 17 00:00:00 2001 From: Jealous Date: Mon, 27 Jan 2025 20:51:08 +0800 Subject: [PATCH] fix(error): fix issue that loading screen persists when object is not found (#241) close AlistGo/alist#7333 --- src/hooks/usePath.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hooks/usePath.ts b/src/hooks/usePath.ts index e5b581bf4a..1c24545fe3 100644 --- a/src/hooks/usePath.ts +++ b/src/hooks/usePath.ts @@ -144,7 +144,7 @@ export const usePath = () => { cancelObj?.() cancelList?.() retry_pass = rp ?? false - handleErr("") + ObjStore.setErr("") if (hasHistory(path)) { return recoverHistory(path) } else if (IsDirRecord[path]) { @@ -221,9 +221,15 @@ export const usePath = () => { notify.error(msg) } } else { - if (first_fetch && msg.endsWith("object not found")) { + const basePath = me().base_path + if ( + first_fetch && + basePath != "/" && + pathname().includes(basePath) && + msg.endsWith("object not found") + ) { first_fetch = false - to(pathname().replace(me().base_path, "")) + to(pathname().replace(basePath, "")) return } if (code === undefined || code >= 0) {