Don't scroll to top on search change except on home
This commit is contained in:
parent
d216b298ba
commit
097000c9da
|
@ -91,6 +91,7 @@ export function ContractSearch(props: {
|
|||
headerClassName?: string
|
||||
useQuerySortLocalStorage?: boolean
|
||||
useQuerySortUrlParams?: boolean
|
||||
isWholePage?: boolean
|
||||
}) {
|
||||
const {
|
||||
user,
|
||||
|
@ -105,6 +106,7 @@ export function ContractSearch(props: {
|
|||
headerClassName,
|
||||
useQuerySortLocalStorage,
|
||||
useQuerySortUrlParams,
|
||||
isWholePage,
|
||||
} = props
|
||||
|
||||
const [numPages, setNumPages] = useState(1)
|
||||
|
@ -139,7 +141,7 @@ export function ContractSearch(props: {
|
|||
setNumPages(results.nbPages)
|
||||
if (freshQuery) {
|
||||
setPages([newPage])
|
||||
window.scrollTo(0, 0)
|
||||
if (isWholePage) window.scrollTo(0, 0)
|
||||
} else {
|
||||
setPages((pages) => [...pages, newPage])
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ const Home = (props: { auth: { user: User } | null }) => {
|
|||
// Update the url without switching pages in Nextjs.
|
||||
history.pushState(null, '', `/${c.creatorUsername}/${c.slug}`)
|
||||
}}
|
||||
isWholePage
|
||||
/>
|
||||
</Col>
|
||||
<button
|
||||
|
|
Loading…
Reference in New Issue
Block a user