31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
// Metro module 15557 (f15558).
|
|
import { useEffect } from "react";
|
|
import SearchQueryStore from "../stores/SearchQueryStore";
|
|
import { SEARCH_TEXT_INPUT_DEBOUNCE_TIME } from "../SearchPlatformConstants";
|
|
import { fetchUserAffinitiesV2 } from "../../../user_affinities/UserAffinitiesActionCreators";
|
|
import SearchPlatformActionCreators from "../SearchPlatformActionCreators";
|
|
import { debounce } from "../../../../_bundle/Module12";
|
|
import SearchPlatformUtils from "../SearchPlatformUtils";
|
|
export function useAutoSearchPeopleTab(a0, a1) {
|
|
let c22182_0 = a0;
|
|
useEffect(() => {
|
|
if (!a1) {
|
|
fetchUserAffinitiesV2();
|
|
SearchPlatformActionCreators.searchPeopleTab(c22182_0, "");
|
|
}
|
|
}, [a1, a0]);
|
|
useEffect(() => {
|
|
if (a1) {
|
|
return void 0;
|
|
}
|
|
return SearchPlatformUtils.subscribeTextInputValue(c22182_0, debounce((a0) => {
|
|
if (!SearchQueryStore.isAutocompleteVisible(c22182_0)) {
|
|
SearchPlatformActionCreators.searchPeopleTab(c22182_0, a0);
|
|
}
|
|
}, SEARCH_TEXT_INPUT_DEBOUNCE_TIME));
|
|
}, [a0, a1]);
|
|
useEffect(() => () => {
|
|
SearchPlatformActionCreators.cleanupPeopleTab(c22182_0);
|
|
}, [a0]);
|
|
}
|