plebbit / plebbit-js

A Javascript API to build applications using plebbit
GNU General Public License v2.0
41 stars 7 forks source link

implement if there's only 1 reply page, don't create reply page cids, only add "best" sort and sort the other types client side #48

Open estebanabaroa opened 2 months ago

estebanabaroa commented 2 months ago

if all replies fit in 1 page, dont create reply page cids to reduce the amount of cids to announce

instead store all the replies only on post.replies.pages.best at the protocol level

and clientside, you can create all the other pages and add them to the Comment instance

so you could create:

post.replies.pages.best post.replies.pages.new post.replies.pages.newflat post.replies.pages.old post.replies.pages.oldFlat

if pageCids exist, dont do this, because it's not possible to create page1 of new and old with only the partial best replies, the first page wouldn't be accurate, instead you should create:

post.replies.pages.best post.replies.pagesCids.new post.replies.pagesCids.newflat post.replies.pagesCids.old post.replies.pagesCids.oldFlat

no need to create post.replies.pagesCids.best because the first page with the cid of page 2 is already included in post.replies.pages.best so it would just waste a cid to announce