fix: skip deleted entries in navigation history

This commit is contained in:
2026-06-06 02:42:20 +08:00
parent 0cd8a79049
commit 40c0953904
4 changed files with 42 additions and 13 deletions
+20 -10
View File
@@ -304,14 +304,19 @@
try {
if (snapshot.nodeId) {
const node = await wailsCall('GetNodeDetail', snapshot.nodeId)
if (node) {
await selectNode(node)
activeTab = snapshot.tab || 'overview'
if (activeTab === 'files' && fileItems.length === 0) {
await loadFolder(node.id)
}
if (!node) {
return false
}
await selectNode(node)
activeTab = snapshot.tab || 'overview'
if (activeTab === 'files' && fileItems.length === 0) {
await loadFolder(node.id)
}
return true
} else if (snapshot.section) {
if (!systemViews.some(view => view.id === snapshot.section)) {
return false
}
await selectSystemView(snapshot.section)
if (snapshot.section === 'trash') {
trashFolderId = snapshot.trashFolderId || ''
@@ -319,7 +324,11 @@
trashSelectedIds = []
await refreshTrash()
}
return true
}
return false
} catch (e) {
return false
} finally {
restoringHistory = false
}
@@ -327,10 +336,11 @@
async function goBack() {
if (closeTopModalForBack()) return
const snapshot = navHistory[navHistory.length - 1]
if (!snapshot) return
navHistory = navHistory.slice(0, -1)
await restoreNavigation(snapshot)
while (navHistory.length > 0) {
const snapshot = navHistory[navHistory.length - 1]
navHistory = navHistory.slice(0, -1)
if (await restoreNavigation(snapshot)) return
}
}
function handleMouseNav(e) {