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 by = router.query.by || ''
|
||||
const by = router.query.by || (what === 'stackers' ? 'stacked' : 'votes')
|
||||
const when = router.query.when || ''
|
||||
|
||||
return (
|
||||
|
|
|
@ -42,11 +42,9 @@ export default function UserList ({ ssrData, query, variables, destructureData }
|
|||
const [statComps, setStatComps] = useState(seperate(STAT_COMPONENTS, Seperator))
|
||||
|
||||
useEffect(() => {
|
||||
if (variables?.by) {
|
||||
// shift the stat we are sorting by to the front
|
||||
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])
|
||||
|
||||
const { users, cursor } = useMemo(() => {
|
||||
|
|
Loading…
Reference in New Issue