Sort bets/comments on client. Somehow server order is getting flipped?

This commit is contained in:
James Grugett 2022-02-17 18:18:40 -06:00
parent 8f40350a75
commit c48913d91e
2 changed files with 5 additions and 3 deletions

View File

@ -14,9 +14,7 @@ export const useBets = (contractId: string) => {
export const useBetsWithoutAntes = (contract: Contract, initialBets: Bet[]) => {
const [bets, setBets] = useState<Bet[]>(
withoutAnteBets(contract, initialBets).sort(
(bet1, bet2) => bet1.createdTime - bet2.createdTime
)
withoutAnteBets(contract, initialBets)
)
useEffect(() => {

View File

@ -82,6 +82,10 @@ export default function ContractPage(props: {
const contract = useContractWithPreload(props.slug, props.contract)
const { bets, comments } = props
// Sort for now to see if bug is fixed.
comments.sort((c1, c2) => c1.createdTime - c2.createdTime)
bets.sort((bet1, bet2) => bet1.createdTime - bet2.createdTime)
const folds = (useFoldsWithTags(contract?.tags) ?? props.folds).filter(
(fold) => fold.followCount > 1 || user?.id === fold.curatorId
)