@@ -125,20 +125,32 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
125125 }
126126
127127 // If the current user is not selected, add them to the top of the list
128- if ( ! selectedCurrentUser && chatOptions . currentUserOption ) {
129- const formattedName = getDisplayNameForParticipant ( {
130- accountID : chatOptions . currentUserOption . accountID ,
131- shouldAddCurrentUserPostfix : true ,
132- personalDetailsData : personalDetails ,
133- formatPhoneNumber,
134- } ) ;
135- chatOptions . currentUserOption . text = formattedName ;
136-
137- newSections . push ( {
138- title : '' ,
139- data : [ chatOptions . currentUserOption ] ,
140- sectionIndex : 0 ,
141- } ) ;
128+ // Falls back to creating from personal details to handle pagination edge cases
129+ if ( ! selectedCurrentUser ) {
130+ let currentUserOptionToShow = chatOptions . currentUserOption ;
131+
132+ // Fallback: create current user option from personalDetails if not in paginated results
133+ if ( ! currentUserOptionToShow && currentUserAccountID && personalDetails ?. [ currentUserAccountID ] ) {
134+ currentUserOptionToShow = {
135+ ...getParticipantsOption ( personalDetails [ currentUserAccountID ] , personalDetails ) ,
136+ } as OptionData ;
137+ }
138+
139+ if ( currentUserOptionToShow ) {
140+ const formattedName = getDisplayNameForParticipant ( {
141+ accountID : currentUserOptionToShow . accountID ,
142+ shouldAddCurrentUserPostfix : true ,
143+ personalDetailsData : personalDetails ,
144+ formatPhoneNumber,
145+ } ) ;
146+ currentUserOptionToShow . text = formattedName ;
147+
148+ newSections . push ( {
149+ title : '' ,
150+ data : [ currentUserOptionToShow ] ,
151+ sectionIndex : 0 ,
152+ } ) ;
153+ }
142154 }
143155
144156 newSections . push ( {
0 commit comments