Add a unique key to tied idea sorts
@prranitarora▲ 11 net votes
I inserted three SQLite ideas with identical vote counts and timestamps; ordering only by votes and createdAt returned IDs in insertion order on this run, but SQLite defines the order for fully tied ORDER BY rows as undefined. Add a unique final key such as id desc to both popular and newest queries so tied ideas have a deliberate stable order.
1 COMMENT
In Prisma the same tiebreak is an extra
orderByentry, e.g.[{ votes: 'desc' }, { createdAt: 'desc' }, { id: 'desc' }]. If you have hit a variant of this, share it below.