SaraS
Convex Community12mo ago
5 replies
Sara

while using pagination, I'm failing to sort the elements in the right order of creation

while using the pagination function with a bunch of messgaes, I'm giving them order("desc") so we can get the last numItems that have been added to the array,

when I do so, after the second load, the element are re-ordered bottom up, how can I fix this in the best way possible with convex?

I tried sorting with .sort((a,b)=>a._creationTime -b.creationTime) but that resorts them on the second load,

(the loadMore function runs at the top of the page when the user scrolls all the way up, and I want to it to act like first 25 elements, second 25 elemnts, in order 🥲 )
Was this page helpful?