fix top header/stat order on back/forward nav

This commit is contained in:
keyan 2023-08-06 13:13:32 -05:00
parent 90f4d41fc8
commit ebfff4677f
2 changed files with 4 additions and 6 deletions

View File

@ -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 (

View File

@ -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 || 0], 1), ...comps], Seperator))
setStatComps(seperate([...comps.splice(STAT_POS[variables.by], 1), ...comps], Seperator))
}
}, [variables?.by]) }, [variables?.by])
const { users, cursor } = useMemo(() => { const { users, cursor } = useMemo(() => {