Skip to content

Commit d9956e6

Browse files
authored
fix(error): fix issue that loading screen persists when object is not found (#241)
close AlistGo/alist#7333
1 parent 3dce0a8 commit d9956e6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/hooks/usePath.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const usePath = () => {
144144
cancelObj?.()
145145
cancelList?.()
146146
retry_pass = rp ?? false
147-
handleErr("")
147+
ObjStore.setErr("")
148148
if (hasHistory(path)) {
149149
return recoverHistory(path)
150150
} else if (IsDirRecord[path]) {
@@ -221,9 +221,15 @@ export const usePath = () => {
221221
notify.error(msg)
222222
}
223223
} else {
224-
if (first_fetch && msg.endsWith("object not found")) {
224+
const basePath = me().base_path
225+
if (
226+
first_fetch &&
227+
basePath != "/" &&
228+
pathname().includes(basePath) &&
229+
msg.endsWith("object not found")
230+
) {
225231
first_fetch = false
226-
to(pathname().replace(me().base_path, ""))
232+
to(pathname().replace(basePath, ""))
227233
return
228234
}
229235
if (code === undefined || code >= 0) {

0 commit comments

Comments
 (0)