Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

prevent duplicate keys in feed tab bar (#2666)

authored by

Hailey and committed by
GitHub
28455f49 faf48db6

+27 -15
+13 -7
src/view/com/pager/FeedsTabBar.web.tsx
··· 88 88 const navigation = useNavigation<NavigationProp>() 89 89 const {headerMinimalShellTransform} = useMinimalShellMode() 90 90 const {headerHeight} = useShellLayout() 91 - const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : [] 92 - const showFeedsLinkInTabBar = hasSession && !hasPinnedCustom 93 - const items = showFeedsLinkInTabBar 94 - ? pinnedDisplayNames.concat('Feeds ✨') 95 - : pinnedDisplayNames 91 + 92 + const items = React.useMemo(() => { 93 + if (!hasSession) return [] 94 + 95 + const pinnedNames = feeds.map(f => f.displayName) 96 + 97 + if (!hasPinnedCustom) { 98 + return pinnedNames.concat('Feeds ✨') 99 + } 100 + return pinnedNames 101 + }, [hasSession, hasPinnedCustom, feeds]) 96 102 97 103 const onPressDiscoverFeeds = React.useCallback(() => { 98 104 if (isWeb) { ··· 105 111 106 112 const onSelect = React.useCallback( 107 113 (index: number) => { 108 - if (showFeedsLinkInTabBar && index === items.length - 1) { 114 + if (hasSession && !hasPinnedCustom && index === items.length - 1) { 109 115 onPressDiscoverFeeds() 110 116 } else if (props.onSelect) { 111 117 props.onSelect(index) 112 118 } 113 119 }, 114 - [items.length, onPressDiscoverFeeds, props, showFeedsLinkInTabBar], 120 + [items.length, onPressDiscoverFeeds, props, hasSession, hasPinnedCustom], 115 121 ) 116 122 117 123 return (
+13 -7
src/view/com/pager/FeedsTabBarMobile.tsx
··· 36 36 const {feeds, hasPinnedCustom} = usePinnedFeedsInfos() 37 37 const {headerHeight} = useShellLayout() 38 38 const {headerMinimalShellTransform} = useMinimalShellMode() 39 - const pinnedDisplayNames = hasSession ? feeds.map(f => f.displayName) : [] 40 - const showFeedsLinkInTabBar = hasSession && !hasPinnedCustom 41 - const items = showFeedsLinkInTabBar 42 - ? pinnedDisplayNames.concat('Feeds ✨') 43 - : pinnedDisplayNames 39 + 40 + const items = React.useMemo(() => { 41 + if (!hasSession) return [] 42 + 43 + const pinnedNames = feeds.map(f => f.displayName) 44 + 45 + if (!hasPinnedCustom) { 46 + return pinnedNames.concat('Feeds ✨') 47 + } 48 + return pinnedNames 49 + }, [hasSession, hasPinnedCustom, feeds]) 44 50 45 51 const onPressFeedsLink = React.useCallback(() => { 46 52 if (isWeb) { ··· 53 59 54 60 const onSelect = React.useCallback( 55 61 (index: number) => { 56 - if (showFeedsLinkInTabBar && index === items.length - 1) { 62 + if (hasSession && !hasPinnedCustom && index === items.length - 1) { 57 63 onPressFeedsLink() 58 64 } else if (props.onSelect) { 59 65 props.onSelect(index) 60 66 } 61 67 }, 62 - [items.length, onPressFeedsLink, props, showFeedsLinkInTabBar], 68 + [items.length, onPressFeedsLink, props, hasSession, hasPinnedCustom], 63 69 ) 64 70 65 71 const onPressAvi = React.useCallback(() => {
+1 -1
src/view/com/pager/TabBar.tsx
··· 78 78 return ( 79 79 <PressableWithHover 80 80 testID={`${testID}-selector-${i}`} 81 - key={item} 81 + key={`${item}-${i}`} 82 82 onLayout={e => onItemLayout(e, i)} 83 83 style={[styles.item, selected && indicatorStyle]} 84 84 hoverStyle={pal.viewLight}