conditional concat

This commit is contained in:
Hailey
2024-06-24 15:35:37 -07:00
parent 99fd0ce773
commit 1026de4082
+9 -4
View File
@@ -46,11 +46,16 @@ export function StepFeeds({moderationOpts}: {moderationOpts: ModerationOpts}) {
limit: 30, limit: 30,
}) })
const popularFeeds = popularFeedsPages?.pages.flatMap(p => p.feeds) ?? [] const popularFeeds = popularFeedsPages?.pages.flatMap(p => p.feeds) ?? []
// If we have saved feeds already loaded, display them immediately
// Then, if we also have popular feeds we can concat them to the saved feeds
const suggestedFeeds = const suggestedFeeds =
isFetchedSavedFeeds && !isLoadingPopularFeeds savedFeeds || isFetchedSavedFeeds
? savedFeeds.concat( ? popularFeeds
popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)), ? savedFeeds.concat(
) popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)),
)
: savedFeeds
: undefined : undefined
const {data: searchedFeeds, isFetching: isFetchingSearchedFeeds} = const {data: searchedFeeds, isFetching: isFetchingSearchedFeeds} =