Only autofocus search if no query params set
This commit is contained in:
parent
6a21067440
commit
f35799c129
|
@ -4,6 +4,7 @@ import { ContractSearch } from 'web/components/contract-search'
|
||||||
import { useTracking } from 'web/hooks/use-tracking'
|
import { useTracking } from 'web/hooks/use-tracking'
|
||||||
import { useUser } from 'web/hooks/use-user'
|
import { useUser } from 'web/hooks/use-user'
|
||||||
import { usePrefetch } from 'web/hooks/use-prefetch'
|
import { usePrefetch } from 'web/hooks/use-prefetch'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
export default function Search() {
|
export default function Search() {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
@ -11,6 +12,10 @@ export default function Search() {
|
||||||
|
|
||||||
useTracking('view search')
|
useTracking('view search')
|
||||||
|
|
||||||
|
const { query } = useRouter()
|
||||||
|
const { q, s, p } = query
|
||||||
|
const autoFocus = !q && !s && !p
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Col className="mx-auto w-full p-2">
|
<Col className="mx-auto w-full p-2">
|
||||||
|
@ -18,7 +23,7 @@ export default function Search() {
|
||||||
user={user}
|
user={user}
|
||||||
persistPrefix="search"
|
persistPrefix="search"
|
||||||
useQueryUrlParam={true}
|
useQueryUrlParam={true}
|
||||||
autoFocus
|
autoFocus={autoFocus}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user