diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-29 17:35:57 -0800 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-11-29 17:35:57 -0800 |
commit | 4c7b9652dbe858d5357d4e983c110c84c9e5a46e (patch) | |
tree | cf012d95b87edaec87c492ab4a20d8fd64d9b1c5 /src/state/queries/feed.ts | |
parent | dc53ef1ec17d4c89ace36ed64d1217caaa54cdb9 (diff) | |
parent | 3fbac466ac8554fcb690fccbe0053a5be07801d7 (diff) | |
download | voidsky-4c7b9652dbe858d5357d4e983c110c84c9e5a46e.tar.zst |
Merge branch '2011-link-in-feeds-tab-bar' of https://github.com/CooperEdmunds/social-app into CooperEdmunds-2011-link-in-feeds-tab-bar
Diffstat (limited to 'src/state/queries/feed.ts')
-rw-r--r-- | src/state/queries/feed.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index b5d491a5c..3266b0f6b 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -246,13 +246,20 @@ const FOLLOWING_FEED_STUB: FeedSourceInfo = { likeUri: '', } -export function usePinnedFeedsInfos(): FeedSourceInfo[] { +export function usePinnedFeedsInfos(): { + feeds: FeedSourceInfo[] + hasPinnedCustomFeedOrList: boolean +} { const queryClient = useQueryClient() const [tabs, setTabs] = React.useState<FeedSourceInfo[]>([ FOLLOWING_FEED_STUB, ]) const {data: preferences} = usePreferencesQuery() + const hasPinnedCustomFeedOrList = React.useMemo<boolean>(() => { + return tabs.some(tab => tab !== FOLLOWING_FEED_STUB) + }, [tabs]) + React.useEffect(() => { if (!preferences?.feeds?.pinned) return const uris = preferences.feeds.pinned @@ -300,5 +307,5 @@ export function usePinnedFeedsInfos(): FeedSourceInfo[] { fetchFeedInfo() }, [queryClient, setTabs, preferences?.feeds?.pinned]) - return tabs + return {feeds: tabs, hasPinnedCustomFeedOrList} } |