xmtp / libxmtp

LibXMTP is a shared library encapsulating the core functionality of the XMTP messaging protocol, such as cryptography, networking, and language bindings.
MIT License
45 stars 19 forks source link

Join table on group and groupMessages for sorting by last message #1181

Open nplasterer opened 3 days ago

nplasterer commented 3 days ago

I do this in the sdks but it would be way more performant if I could do it in libxmtp and also allow limit to actually work correctly.

neekolas commented 3 days ago

Great idea on the join table.

What's the problem with limit?

nplasterer commented 3 days ago

if you ask for limit 1 of the list of groups and order by last message. Since ordering by last message currently happens on the sdk side and limit happens in the database you will get the first 10 items that were ordered by created at and then order them by last message. When in reality you want the last 10 items that are ordered by last message. Does that make sense?

nplasterer commented 3 days ago

Add a field on group for lastMessagethat gets written everytime. A new message is sent.