fix: 🐛

This commit is contained in:
codytseng
2025-05-07 23:14:24 +08:00
parent 04c84db0ae
commit 55862da1d3
3 changed files with 12 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ const PrimaryPageLayout = forwardRef(
const smallScreenScrollAreaRef = useRef<HTMLDivElement>(null)
const smallScreenLastScrollTopRef = useRef(0)
const { isSmallScreen } = useScreenSize()
const { current } = usePrimaryPage()
const { current, display } = usePrimaryPage()
useImperativeHandle(
ref,
@@ -44,7 +44,7 @@ const PrimaryPageLayout = forwardRef(
useEffect(() => {
if (isSmallScreen) {
if (smallScreenScrollAreaRef.current?.checkVisibility()) {
window.scrollTo({ top: smallScreenLastScrollTopRef.current })
window.scrollTo({ top: smallScreenLastScrollTopRef.current, behavior: 'instant' })
}
const handleScroll = () => {
if (smallScreenScrollAreaRef.current?.checkVisibility()) {
@@ -56,7 +56,7 @@ const PrimaryPageLayout = forwardRef(
window.removeEventListener('scroll', handleScroll)
}
}
}, [current, isSmallScreen])
}, [current, isSmallScreen, display])
if (isSmallScreen) {
return (