fix: reset scroll position record on account switch
This commit is contained in:
@@ -3,6 +3,7 @@ import { Titlebar } from '@/components/Titlebar'
|
||||
import { ScrollArea } from '@/components/ui/scroll-area'
|
||||
import { TPrimaryPageName, usePrimaryPage } from '@/PageManager'
|
||||
import { DeepBrowsingProvider } from '@/providers/DeepBrowsingProvider'
|
||||
import { useNostr } from '@/providers/NostrProvider'
|
||||
import { useUserPreferences } from '@/providers/UserPreferencesProvider'
|
||||
import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react'
|
||||
|
||||
@@ -23,6 +24,7 @@ const PrimaryPageLayout = forwardRef(
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
const { pubkey } = useNostr()
|
||||
const scrollAreaRef = useRef<HTMLDivElement>(null)
|
||||
const smallScreenScrollAreaRef = useRef<HTMLDivElement>(null)
|
||||
const smallScreenLastScrollTopRef = useRef(0)
|
||||
@@ -67,6 +69,10 @@ const PrimaryPageLayout = forwardRef(
|
||||
}
|
||||
}, [current, enableSingleColumnLayout, display])
|
||||
|
||||
useEffect(() => {
|
||||
smallScreenLastScrollTopRef.current = 0
|
||||
}, [pubkey])
|
||||
|
||||
if (enableSingleColumnLayout) {
|
||||
return (
|
||||
<DeepBrowsingProvider active={current === pageName && display}>
|
||||
|
||||
Reference in New Issue
Block a user