From 1026de40829011281b091354e3590a883ec15e20 Mon Sep 17 00:00:00 2001 From: Hailey Date: Mon, 24 Jun 2024 15:35:37 -0700 Subject: [PATCH] conditional concat --- src/screens/StarterPack/Wizard/StepFeeds.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/screens/StarterPack/Wizard/StepFeeds.tsx b/src/screens/StarterPack/Wizard/StepFeeds.tsx index ed8bb97ac9..09df4c6e52 100644 --- a/src/screens/StarterPack/Wizard/StepFeeds.tsx +++ b/src/screens/StarterPack/Wizard/StepFeeds.tsx @@ -46,11 +46,16 @@ export function StepFeeds({moderationOpts}: {moderationOpts: ModerationOpts}) { limit: 30, }) 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 = - isFetchedSavedFeeds && !isLoadingPopularFeeds - ? savedFeeds.concat( - popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)), - ) + savedFeeds || isFetchedSavedFeeds + ? popularFeeds + ? savedFeeds.concat( + popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)), + ) + : savedFeeds : undefined const {data: searchedFeeds, isFetching: isFetchingSearchedFeeds} =