You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Selected items that don't show up in Recents / Contacts and aren't the current user — surface them but respect the search term.
109
-
// Dedupe by accountID for real users and by login for name-only attendees (which share DEFAULT_NUMBER_ID).
106
+
// Selected items not visible in Recents / Contacts and not the current user — show them in a section above, but only if they match the search term.
107
+
// Dedupe by accountID for real users and by login for name-only attendees (which all share DEFAULT_NUMBER_ID).
110
108
constvisibleAccountIDs=newSet<number>(
111
109
[...personalDetailsWithoutCurrentUser, ...recentReportsWithoutCurrentUser].map((option)=>option.accountID).filter((id): id is number=>!!id&&id!==CONST.DEFAULT_NUMBER_ID),
112
110
);
@@ -119,7 +117,7 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
119
117
matchesSearchTerm(option),
120
118
);
121
119
122
-
// Render-ready current user row with the "(you)" suffix; falls back to personalDetails if pagination dropped them.
120
+
// Current user row with the "(you)" suffix. Falls back to personalDetails when pagination drops them from availableOptions.
123
121
letcurrentUserRow: OptionData|undefined;
124
122
if(areOptionsInitialized){
125
123
letcandidate=currentUserOption??undefined;
@@ -152,9 +150,9 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
// Fallback: construct a minimal option from the identifier string to preserve
240
-
// name-only filters across sessions (e.g., after cache clear or on another device)
233
+
// Last resort: build a minimal option from the identifier so name-only filters survive
234
+
// a cache clear or a switch to another device.
241
235
return{
242
236
text: identifier,
243
237
alternateText: identifier,
@@ -269,7 +263,7 @@ function SearchFiltersParticipantsSelector({initialAccountIDs, onFiltersUpdate,
269
263
}
270
264
271
265
setSelectedOptions(preSelectedOptions);
272
-
// eslint-disable-next-line react-hooks/set-state-in-effect -- one-shot flag so the snapshot waits for hydration; derivable state isn't enough since the effect can resolve to an empty array.
266
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- one-shot flag the pinning snapshot waits on; derivable state doesn't work because hydration can resolve to an empty array.
273
267
setHasAttemptedHydration(true);
274
268
// eslint-disable-next-line react-hooks/exhaustive-deps -- this should react only to changes in form data
/** Identifiers (matched against the result of `getKey`, or `item.keyForList` when `getKey` is omitted) of items that should be pinned at the top on first capture. */
7
+
/** Item identifiers to pin on first capture. Matched against `getKey(item)`, or `item.keyForList` if `getKey` is omitted. */
8
8
initialSelectedValues: string[];
9
9
10
-
/** Whether the input sections are ready to be inspected. Capture happens on the first render where this becomes true. */
10
+
/** Set to `true` once the sections are ready to inspect — capture fires on the next render. */
11
11
canCapture: boolean;
12
12
13
-
/**
14
-
* Optional predicate to keep a captured item in the pinned section. Required for lazy-loaded
15
-
* lists where pinned rows must outlive the current section data (e.g. to apply the search filter
16
-
* to pinned rows that aren't otherwise present in the visible sections).
17
-
*/
13
+
/** Optional filter for pinned rows (e.g. to honor a search term). Needed when pinned rows may not appear in the input `sections`. */
18
14
shouldRenderPinned?: (item: TItem)=>boolean;
19
15
20
-
/**
21
-
* Optional extractor for the identity used to match items against `initialSelectedValues`.
22
-
* Defaults to `item.keyForList`. Use this when the caller's identifier scheme doesn't match
23
-
* `keyForList` — e.g. participants are passed in by accountID but their `keyForList` is the
24
-
* 1:1 DM's reportID.
25
-
*/
16
+
/** Optional identity extractor. Defaults to `item.keyForList`. Override when the caller's identifier doesn't match `keyForList`. */
26
17
getKey?: (item: TItem)=>string|undefined;
27
18
};
28
19
29
20
/**
30
-
* Pins pre-selected rows to a new top section on first ready render, then locks the order.
31
-
* Items are matched against `initialSelectedValues` using `getKey` (or `keyForList` when `getKey`
32
-
* is omitted) and removed from their original sections; toggling a pinned row updates `isSelected`
33
-
* in place without moving it. Returns `sections` unchanged while `canCapture` is false or when the
34
-
* combined item count is below `STANDARD_LIST_ITEM_LIMIT`.
21
+
* Pins pre-selected rows to a top section on first ready render, then locks them in place.
22
+
* Toggling a pinned row updates `isSelected` without moving it.
23
+
* Returns `sections` unchanged while not ready, or when the list is shorter than `STANDARD_LIST_ITEM_LIMIT`.
0 commit comments