feat: scroll to top when jumping to the current page

This commit is contained in:
codytseng 2025-01-26 16:28:47 +08:00
parent 82537f192b
commit 23bf7fd005
23 changed files with 235 additions and 132 deletions

View file

@ -4,10 +4,10 @@ import { useFetchRelayInfos, useSearchParams } from '@/hooks'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { useFeed } from '@/providers/FeedProvider'
import { Filter } from 'nostr-tools'
import { useMemo } from 'react'
import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
export default function NoteListPage({ index }: { index?: number }) {
const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
const { t } = useTranslation()
const { relayUrls } = useFeed()
const { searchableRelayUrls } = useFetchRelayInfos(relayUrls)
@ -43,8 +43,10 @@ export default function NoteListPage({ index }: { index?: number }) {
}, [searchParams, JSON.stringify(relayUrls)])
return (
<SecondaryPageLayout index={index} title={title} displayScrollToTopButton>
<SecondaryPageLayout ref={ref} index={index} title={title} displayScrollToTopButton>
<NoteList key={title} filter={filter} relayUrls={urls} />
</SecondaryPageLayout>
)
}
})
NoteListPage.displayName = 'NoteListPage'
export default NoteListPage