fix: 🐛

This commit is contained in:
codytseng
2025-10-26 16:21:40 +08:00
parent d31cda7448
commit 248b4ec93c

View File

@@ -274,19 +274,19 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
}) })
} }
const popSecondaryPage = () => { const popSecondaryPage = (delta = -1) => {
if (secondaryStack.length === 1) { if (secondaryStack.length <= -delta) {
// back to home page // back to home page
window.history.replaceState(null, '', '/') window.history.replaceState(null, '', '/')
setSecondaryStack([]) setSecondaryStack([])
} else { } else {
window.history.go(-1) window.history.go(delta)
} }
} }
const clearSecondaryPages = () => { const clearSecondaryPages = () => {
if (secondaryStack.length === 0) return if (secondaryStack.length === 0) return
window.history.go(-secondaryStack.length) popSecondaryPage(-secondaryStack.length)
} }
if (isSmallScreen) { if (isSmallScreen) {