fix top header/stat order on back/forward nav
This commit is contained in:
parent
90f4d41fc8
commit
ebfff4677f
|
@ -32,7 +32,7 @@ export default function TopHeader ({ sub, cat }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const what = cat
|
const what = cat
|
||||||
const by = router.query.by || ''
|
const by = router.query.by || (what === 'stackers' ? 'stacked' : 'votes')
|
||||||
const when = router.query.when || ''
|
const when = router.query.when || ''
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -42,11 +42,9 @@ export default function UserList ({ ssrData, query, variables, destructureData }
|
||||||
const [statComps, setStatComps] = useState(seperate(STAT_COMPONENTS, Seperator))
|
const [statComps, setStatComps] = useState(seperate(STAT_COMPONENTS, Seperator))
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (variables?.by) {
|
|
||||||
// shift the stat we are sorting by to the front
|
// shift the stat we are sorting by to the front
|
||||||
const comps = [...STAT_COMPONENTS]
|
const comps = [...STAT_COMPONENTS]
|
||||||
setStatComps(seperate([...comps.splice(STAT_POS[variables.by], 1), ...comps], Seperator))
|
setStatComps(seperate([...comps.splice(STAT_POS[variables.by || 0], 1), ...comps], Seperator))
|
||||||
}
|
|
||||||
}, [variables?.by])
|
}, [variables?.by])
|
||||||
|
|
||||||
const { users, cursor } = useMemo(() => {
|
const { users, cursor } = useMemo(() => {
|
||||||
|
|
Loading…
Reference in New Issue