conditional concat
This commit is contained in:
@@ -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} =
|
||||||
|
|||||||
Reference in New Issue
Block a user