Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3380122
D11049.id37019.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11049.id37019.diff
View Options
diff --git a/lib/shared/search-utils.js b/lib/shared/search-utils.js
--- a/lib/shared/search-utils.js
+++ b/lib/shared/search-utils.js
@@ -371,6 +371,11 @@
return usernameToSearch;
}
+const searchIdentityUsersActionTypes = Object.freeze({
+ started: 'SEARCH_USERS_STARTED',
+ success: 'SEARCH_USERS_SUCCESS',
+ failed: 'SEARCH_USERS_FAILED',
+});
function useSearchIdentityUsers(
usernameInputText: string,
): $ReadOnlyArray<User> {
@@ -385,13 +390,14 @@
const forwardLookupSearchText = useForwardLookupSearchText(usernameInputText);
+ const dispatchActionPromise = useDispatchActionPromise();
React.useEffect(() => {
if (forwardLookupSearchText.length === 0) {
setSearchResults([]);
return;
}
- void (async () => {
+ const searchIdentityUsersPromise = (async () => {
try {
const result = await sendPrefixQuery(forwardLookupSearchText);
setSearchResults(
@@ -402,7 +408,16 @@
setSearchResults([]);
}
})();
- }, [currentUserID, forwardLookupSearchText, sendPrefixQuery]);
+ void dispatchActionPromise(
+ searchIdentityUsersActionTypes,
+ searchIdentityUsersPromise,
+ );
+ }, [
+ currentUserID,
+ forwardLookupSearchText,
+ dispatchActionPromise,
+ sendPrefixQuery,
+ ]);
return searchResults;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 9:12 PM (21 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594931
Default Alt Text
D11049.id37019.diff (1 KB)
Attached To
Mode
D11049: [lib] add dispatch action promise to search identity users function
Attached
Detach File
Event Timeline
Log In to Comment