fix: skip deleted entries in navigation history
This commit is contained in:
parent
0cd8a79049
commit
40c0953904
File diff suppressed because one or more lines are too long
|
|
@ -19,7 +19,7 @@
|
|||
background: #13131f;
|
||||
}
|
||||
</style>
|
||||
<script type="module" crossorigin src="/assets/main-2ehud8s_.js"></script>
|
||||
<script type="module" crossorigin src="/assets/main-DqAK36oG.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/main-N_NpVgn3.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -356,6 +356,13 @@ async function runReadyScenario(cdp, url) {
|
|||
await assertEval(cdp, `!document.querySelector('.activity-feed-header h2')`, 'activity: screen title is not duplicated inside body')
|
||||
await assertText(cdp, 'Smoke activity', 'activity feed: event visible')
|
||||
|
||||
await clickText(cdp, '.nav-item', 'Сегодня')
|
||||
await clickText(cdp, '.tree-label', 'Smoke Client')
|
||||
await clickText(cdp, '.tree-label', 'Smoke Project')
|
||||
await deleteSmokeNode(cdp, 'node-client')
|
||||
await dispatchBodyKeydown(cdp, 'Backspace')
|
||||
await assertEval(cdp, `document.querySelector('.header-title')?.innerText.trim() === 'Сегодня'`, 'navigation: Backspace skips deleted history entries')
|
||||
|
||||
await click(cdp, '.nav-add-btn')
|
||||
await waitForSelector(cdp, '.modal-create')
|
||||
await assertText(cdp, 'Создать элемент', 'create node: modal opens')
|
||||
|
|
@ -528,6 +535,15 @@ async function dispatchMouseBack(cdp) {
|
|||
await sleep(150)
|
||||
}
|
||||
|
||||
async function deleteSmokeNode(cdp, id) {
|
||||
await cdp.send('Runtime.evaluate', {
|
||||
expression: `window.__VERSTAK_GUI_SMOKE__.deleteNode(${JSON.stringify(id)})`,
|
||||
awaitPromise: true,
|
||||
returnByValue: true,
|
||||
})
|
||||
await sleep(150)
|
||||
}
|
||||
|
||||
async function setClipboardText(cdp, value) {
|
||||
await cdp.send('Runtime.evaluate', {
|
||||
expression: `window.__VERSTAK_GUI_SMOKE_CLIPBOARD__ = ${JSON.stringify(value)}`,
|
||||
|
|
@ -1347,6 +1363,9 @@ function wailsMockSource() {
|
|||
dropFiles: async (paths) => {
|
||||
if (runtimeHandlers['files-dropped']) await runtimeHandlers['files-dropped'](paths);
|
||||
},
|
||||
deleteNode: async (id) => {
|
||||
detachNode(id);
|
||||
},
|
||||
};
|
||||
})();
|
||||
`
|
||||
|
|
|
|||
Loading…
Reference in New Issue