Fix error getting through by primary feed sort (#3562)

zio/stable
Paul Frazee 2024-04-15 20:41:44 -07:00 committed by GitHub
parent f265d65a18
commit 68d002a966
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 9 deletions

View File

@ -107,21 +107,15 @@ async function whenFollowsIndexed(
}
/**
* Kinda hacky, but we want For Your or Discover to appear as the first pinned
* Kinda hacky, but we want Discover to appear as the first pinned
* feed after Following
*/
export function sortPrimaryAlgorithmFeeds(uris: string[]) {
return uris.sort((a, b) => {
if (a === PRIMARY_FEEDS[0].uri) {
if (a === PRIMARY_FEEDS[0]?.uri) {
return -1
}
if (b === PRIMARY_FEEDS[0].uri) {
return 1
}
if (a === PRIMARY_FEEDS[1].uri) {
return -1
}
if (b === PRIMARY_FEEDS[1].uri) {
if (b === PRIMARY_FEEDS[0]?.uri) {
return 1
}
return a.localeCompare(b)