Prevent having to go back twice from profile / tag search page
This commit is contained in:
parent
b195dcdfd2
commit
67717bbde7
|
@ -17,7 +17,7 @@ import {
|
||||||
} from '../hooks/use-sort-and-query-params'
|
} from '../hooks/use-sort-and-query-params'
|
||||||
import { ContractsGrid } from './contract/contracts-list'
|
import { ContractsGrid } from './contract/contracts-list'
|
||||||
import { Row } from './layout/row'
|
import { Row } from './layout/row'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { Spacer } from './layout/spacer'
|
import { Spacer } from './layout/spacer'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { ENV } from 'common/envs/constants'
|
import { ENV } from 'common/envs/constants'
|
||||||
|
@ -143,7 +143,13 @@ export function ContractSearchInner(props: {
|
||||||
setQuery(query)
|
setQuery(query)
|
||||||
}, [query])
|
}, [query])
|
||||||
|
|
||||||
|
const isFirstRender = useRef(true)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (isFirstRender.current) {
|
||||||
|
isFirstRender.current = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const sort = index.split('contracts-')[1] as Sort
|
const sort = index.split('contracts-')[1] as Sort
|
||||||
if (sort) {
|
if (sort) {
|
||||||
setSort(sort)
|
setSort(sort)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user