What is Nostr?
cesardias / Cesar Dias
npub1ces…t37c
2025-02-08 03:19:34
in reply to nevent1q…azrj

cesardias on Nostr: The main feed isn't fully sorted, I don't think the main feed needs to be fully ...

The main feed isn't fully sorted, I don't think the main feed needs to be fully sorted by date, most people are very used to heavily algorithm feeds to care about a strict chronologic feed, notification feed makes more sense to be fully sorted.

There's a RxJS bufferTime operator on the feed event stream to update the feed in batches of 500ms (which also helps avoids unnecessary re-renders), so let's say we have a batch of 30 notes, I sort these 30 notes by created_at, and insert them at the end of the feed, the next batch the same, if a slow relay returns new events, it will be just added at the end of the feed, without impacting what the user is reading.

The approach works best with timed range pagination (until + since) instead of limit based pagination (limit, then look for a until date), I tried to implement a limit based pagination way too many times but always run into really annoying issues like huge pagination gaps, also the limit approach doesn't work well with the outbox model as you will split a filter of 1000 authors with a limit of 50 events, you ended up with way more than 50 events.
Author Public Key
npub1cesrkrcuelkxyhvupzm48e8hwn4005w0ya5jyvf9kh75mfegqx0q4kt37c