Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Fix duplicates in thread composer (#6068)

authored by

dan and committed by
GitHub
46004fb2 d33ce1de

+22 -4
+1
src/view/com/composer/Composer.tsx
··· 743 743 placeholder={selectTextInputPlaceholder} 744 744 autoFocus 745 745 webForceMinHeight={forceMinHeight} 746 + isActive={isActive} 746 747 setRichText={rt => { 747 748 dispatchPost({type: 'update_richtext', richtext: rt}) 748 749 }}
+1
src/view/com/composer/text-input/TextInput.tsx
··· 44 44 richtext: RichText 45 45 placeholder: string 46 46 webForceMinHeight: boolean 47 + isActive: boolean 47 48 setRichText: (v: RichText) => void 48 49 onPhotoPasted: (uri: string) => void 49 50 onPressPublish: (richtext: RichText) => void
+20 -4
src/view/com/composer/text-input/TextInput.web.tsx
··· 42 42 placeholder: string 43 43 suggestedLinks: Set<string> 44 44 webForceMinHeight: boolean 45 + isActive: boolean 45 46 setRichText: (v: RichText | ((v: RichText) => RichText)) => void 46 47 onPhotoPasted: (uri: string) => void 47 48 onPressPublish: (richtext: RichText) => void ··· 55 56 richtext, 56 57 placeholder, 57 58 webForceMinHeight, 59 + isActive, 58 60 setRichText, 59 61 onPhotoPasted, 60 62 onPressPublish, ··· 94 96 ) 95 97 96 98 React.useEffect(() => { 99 + if (!isActive) { 100 + return 101 + } 97 102 textInputWebEmitter.addListener('publish', onPressPublish) 98 103 return () => { 99 104 textInputWebEmitter.removeListener('publish', onPressPublish) 100 105 } 101 - }, [onPressPublish]) 106 + }, [onPressPublish, isActive]) 107 + 102 108 React.useEffect(() => { 109 + if (!isActive) { 110 + return 111 + } 103 112 textInputWebEmitter.addListener('media-pasted', onPhotoPasted) 104 113 return () => { 105 114 textInputWebEmitter.removeListener('media-pasted', onPhotoPasted) 106 115 } 107 - }, [onPhotoPasted]) 116 + }, [isActive, onPhotoPasted]) 108 117 109 118 React.useEffect(() => { 119 + if (!isActive) { 120 + return 121 + } 122 + 110 123 const handleDrop = (event: DragEvent) => { 111 124 const transfer = event.dataTransfer 112 125 if (transfer) { ··· 144 157 document.body.removeEventListener('dragover', handleDragEnter) 145 158 document.body.removeEventListener('dragleave', handleDragLeave) 146 159 } 147 - }, [setIsDropping]) 160 + }, [setIsDropping, isActive]) 148 161 149 162 const pastSuggestedUris = useRef(new Set<string>()) 150 163 const prevDetectedUris = useRef(new Map<string, LinkFacetMatch>()) ··· 242 255 [editor], 243 256 ) 244 257 React.useEffect(() => { 258 + if (!isActive) { 259 + return 260 + } 245 261 textInputWebEmitter.addListener('emoji-inserted', onEmojiInserted) 246 262 return () => { 247 263 textInputWebEmitter.removeListener('emoji-inserted', onEmojiInserted) 248 264 } 249 - }, [onEmojiInserted]) 265 + }, [onEmojiInserted, isActive]) 250 266 251 267 React.useImperativeHandle(ref, () => ({ 252 268 focus: () => {