diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-29 17:49:46 -0800 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-11-29 17:49:46 -0800 |
commit | c07d27645f2fdeb3d172de53c7a58b4b97b55421 (patch) | |
tree | 567382e9515aedfb84440767a6d9fbab6a2d1bbb /src/state/queries/feed.ts | |
parent | dc53ef1ec17d4c89ace36ed64d1217caaa54cdb9 (diff) | |
parent | 1140b05b835d8487b24d4b83ad932f46fa00c2d9 (diff) | |
download | voidsky-c07d27645f2fdeb3d172de53c7a58b4b97b55421.tar.zst |
Merge branch 'CooperEdmunds-2011-link-in-feeds-tab-bar' into main
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..a73e64e8a 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[] + hasPinnedCustom: boolean +} { const queryClient = useQueryClient() const [tabs, setTabs] = React.useState<FeedSourceInfo[]>([ FOLLOWING_FEED_STUB, ]) const {data: preferences} = usePreferencesQuery() + const hasPinnedCustom = 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, hasPinnedCustom} } |