Browse Source

fix: 🐛

imwald
codytseng 10 months ago
parent
commit
04c84db0ae
  1. 28
      src/PageManager.tsx

28
src/PageManager.tsx

@ -207,20 +207,24 @@ export function PageManager({ maxStackSize = 5 }: { maxStackSize?: number }) {
} }
const pushSecondaryPage = (url: string, index?: number) => { const pushSecondaryPage = (url: string, index?: number) => {
setSecondaryStack((prevStack) => { // FIXME: Temporary solution to prevent the back action after closing
if (isCurrentPage(prevStack, url)) { // the modal when navigating.
const currentItem = prevStack[prevStack.length - 1] setTimeout(() => {
if (currentItem?.ref?.current) { setSecondaryStack((prevStack) => {
currentItem.ref.current.scrollToTop() if (isCurrentPage(prevStack, url)) {
const currentItem = prevStack[prevStack.length - 1]
if (currentItem?.ref?.current) {
currentItem.ref.current.scrollToTop()
}
return prevStack
} }
return prevStack
}
const { newStack, newItem } = pushNewPageToStack(prevStack, url, maxStackSize, index) const { newStack, newItem } = pushNewPageToStack(prevStack, url, maxStackSize, index)
if (newItem) { if (newItem) {
window.history.pushState({ index: newItem.index, url }, '', url) window.history.pushState({ index: newItem.index, url }, '', url)
} }
return newStack return newStack
})
}) })
} }

Loading…
Cancel
Save