diff options
Diffstat (limited to 'src/view/com/pager/FeedsTabBar.web.tsx')
-rw-r--r-- | src/view/com/pager/FeedsTabBar.web.tsx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/view/com/pager/FeedsTabBar.web.tsx b/src/view/com/pager/FeedsTabBar.web.tsx index 385da5544..9fe03b7e9 100644 --- a/src/view/com/pager/FeedsTabBar.web.tsx +++ b/src/view/com/pager/FeedsTabBar.web.tsx @@ -88,11 +88,17 @@ function FeedsTabBarTablet( const navigation = useNavigation<NavigationProp>() const {headerMinimalShellTransform} = useMinimalShellMode() const {headerHeight} = useShellLayout() - const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : [] - const showFeedsLinkInTabBar = hasSession && !hasPinnedCustom - const items = showFeedsLinkInTabBar - ? pinnedDisplayNames.concat('Feeds ✨') - : pinnedDisplayNames + + const items = React.useMemo(() => { + if (!hasSession) return [] + + const pinnedNames = feeds.map(f => f.displayName) + + if (!hasPinnedCustom) { + return pinnedNames.concat('Feeds ✨') + } + return pinnedNames + }, [hasSession, hasPinnedCustom, feeds]) const onPressDiscoverFeeds = React.useCallback(() => { if (isWeb) { @@ -105,13 +111,13 @@ function FeedsTabBarTablet( const onSelect = React.useCallback( (index: number) => { - if (showFeedsLinkInTabBar && index === items.length - 1) { + if (hasSession && !hasPinnedCustom && index === items.length - 1) { onPressDiscoverFeeds() } else if (props.onSelect) { props.onSelect(index) } }, - [items.length, onPressDiscoverFeeds, props, showFeedsLinkInTabBar], + [items.length, onPressDiscoverFeeds, props, hasSession, hasPinnedCustom], ) return ( |