Fix country feeds showing posts oldest-first instead of newest-first
Country feeds (iso3166) are social feeds and should display in reverse-chronological order. URL and ISBN comment threads keep the existing oldest-first conversation order. Closes #64
This commit is contained in:
@@ -277,8 +277,12 @@ export function ExternalContentPage() {
|
||||
? topLevel.filter((r) => !isEventMuted(r, muteItems))
|
||||
: topLevel;
|
||||
|
||||
// Sort oldest-first for threaded conversation view (useComments returns newest-first)
|
||||
const sorted = [...filteredTopLevel].sort((a, b) => a.created_at - b.created_at);
|
||||
// Country feeds are social feeds (newest-first); other types are threaded conversations (oldest-first)
|
||||
const sorted = [...filteredTopLevel].sort((a, b) =>
|
||||
content?.type === 'iso3166'
|
||||
? b.created_at - a.created_at
|
||||
: a.created_at - b.created_at
|
||||
);
|
||||
|
||||
return sorted.map((reply) => {
|
||||
const directReplies = commentsData?.getDirectReplies(reply.id) ?? [];
|
||||
|
||||
Reference in New Issue
Block a user