File tree Expand file tree Collapse file tree 3 files changed +8
-12
lines changed
components/selected_users Expand file tree Collapse file tree 3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -32,17 +32,17 @@ type Props = {
3232 keyboardOverlap ?: number ;
3333
3434 /**
35- * A handler function that will select or deselect a user when clicked on .
35+ * A handler function that will trigger when the button is pressed .
3636 */
37- onPress : ( selectedId ?: { [ id : string ] : boolean } ) => void ;
37+ onPress : ( ) => void ;
3838
3939 /**
4040 * A handler function that will deselect a user when clicked on.
4141 */
4242 onRemove : ( id : string ) => void ;
4343
4444 /**
45- * An object mapping user ids to a falsey value indicating whether or not they have been selected .
45+ * A set of the selected user ids .
4646 */
4747 selectedIds : Set < string > ;
4848
@@ -161,7 +161,7 @@ export default function SelectedUsers({
161161
162162 const usersChipsHeight = useSharedValue ( 0 ) ;
163163 const [ isVisible , setIsVisible ] = useState ( false ) ;
164- const numberSelectedIds = Object . keys ( selectedIds ) . length ;
164+ const numberSelectedIds = selectedIds . size ;
165165
166166 const users = useMemo ( ( ) => {
167167 const u = [ ] ;
Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ export default function ChannelAddMembers({
163163 return ;
164164 }
165165
166- const idsToUse = Object . keys ( selectedIds ) ;
166+ const idsToUse = Array . from ( selectedIds ) ;
167167 if ( ! idsToUse . length ) {
168168 return ;
169169 }
Original file line number Diff line number Diff line change @@ -152,14 +152,14 @@ export default function CreateDirectMessage({
152152 return ! result . error ;
153153 } , [ intl , serverUrl ] ) ;
154154
155- const startConversation = useCallback ( async ( selectedId ?: { [ id : string ] : boolean } ) => {
155+ const startConversation = useCallback ( async ( selectedId ?: string ) => {
156156 if ( startingConversation ) {
157157 return ;
158158 }
159159
160160 setStartingConversation ( true ) ;
161161
162- const idsToUse = selectedId ? Object . keys ( selectedId ) : Object . keys ( selectedIds ) ;
162+ const idsToUse = selectedId ? [ selectedId ] : Array . from ( selectedIds ) ;
163163 let success ;
164164 if ( idsToUse . length === 0 ) {
165165 success = false ;
@@ -178,11 +178,7 @@ export default function CreateDirectMessage({
178178
179179 const handleSelectProfile = useCallback ( ( user : UserProfile ) => {
180180 if ( user . id === currentUserId ) {
181- const selectedId = {
182- [ currentUserId ] : true ,
183- } ;
184-
185- startConversation ( selectedId ) ;
181+ startConversation ( currentUserId ) ;
186182 } else {
187183 clearSearch ( ) ;
188184 setSelectedIds ( ( current ) => {
You can’t perform that action at this time.
0 commit comments