about summary refs log tree commit diff
path: root/src/screens/StarterPack/Wizard/StepFeeds.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-24 15:48:10 -0700
committerGitHub <noreply@github.com>2024-06-24 15:48:10 -0700
commit9e89ddeb1c6bd84594f5b9a9152cd0d9b974b9a8 (patch)
tree6fc3fb604944a2e191cc8afb8be31d5550e4297a /src/screens/StarterPack/Wizard/StepFeeds.tsx
parentbce3338a0236cdce2ef620c1f344b077390df0f5 (diff)
downloadvoidsky-9e89ddeb1c6bd84594f5b9a9152cd0d9b974b9a8.tar.zst
Wait for preferences before showing suggested feeds (#4618)
Diffstat (limited to 'src/screens/StarterPack/Wizard/StepFeeds.tsx')
-rw-r--r--src/screens/StarterPack/Wizard/StepFeeds.tsx18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/screens/StarterPack/Wizard/StepFeeds.tsx b/src/screens/StarterPack/Wizard/StepFeeds.tsx
index 5170edc6e..878d17ce0 100644
--- a/src/screens/StarterPack/Wizard/StepFeeds.tsx
+++ b/src/screens/StarterPack/Wizard/StepFeeds.tsx
@@ -32,7 +32,7 @@ export function StepFeeds({moderationOpts}: {moderationOpts: ModerationOpts}) {
   const throttledQuery = useThrottledValue(query, 500)
   const {screenReaderEnabled} = useA11y()
 
-  const {data: savedFeedsAndLists, isLoading: isLoadingSavedFeeds} =
+  const {data: savedFeedsAndLists, isFetchedAfterMount: isFetchedSavedFeeds} =
     useSavedFeeds()
   const savedFeeds = savedFeedsAndLists?.feeds
     .filter(f => f.type === 'feed' && f.view.uri !== DISCOVER_FEED_URI)
@@ -46,15 +46,23 @@ export function StepFeeds({moderationOpts}: {moderationOpts: ModerationOpts}) {
     limit: 30,
   })
   const popularFeeds = popularFeedsPages?.pages.flatMap(p => p.feeds) ?? []
-  const suggestedFeeds = savedFeeds.concat(
-    popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)),
-  )
+
+  // If we have saved feeds already loaded, display them immediately
+  // Then, when popular feeds have loaded we can concat them to the saved feeds
+  const suggestedFeeds =
+    savedFeeds || isFetchedSavedFeeds
+      ? popularFeeds
+        ? savedFeeds.concat(
+            popularFeeds.filter(f => !savedFeeds.some(sf => sf.uri === f.uri)),
+          )
+        : savedFeeds
+      : undefined
 
   const {data: searchedFeeds, isFetching: isFetchingSearchedFeeds} =
     useSearchPopularFeedsQuery({q: throttledQuery})
 
   const isLoading =
-    isLoadingSavedFeeds || isLoadingPopularFeeds || isFetchingSearchedFeeds
+    !isFetchedSavedFeeds || isLoadingPopularFeeds || isFetchingSearchedFeeds
 
   const renderItem = ({
     item,