* feat: wip onboarding * fix: generate graphql front * wip: onboarding * feat: login/register and edit profile * fix: unused import * fix: test * Use DEBUG_MODE instead of STAGE and mute typescript depth exceed errors * Fix seeds * Fix onboarding when coming from google * Fix * Fix lint * Fix ci * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
33 lines
922 B
TypeScript
33 lines
922 B
TypeScript
import debounce from 'lodash.debounce';
|
|
|
|
import { useRecoilScopedState } from '@/recoil-scope/hooks/useRecoilScopedState';
|
|
|
|
import { relationPickerHoverIndexScopedState } from '../states/relationPickerHoverIndexScopedState';
|
|
import { relationPickerSearchFilterScopedState } from '../states/relationPickerSearchFilterScopedState';
|
|
|
|
export function useEntitySelectSearch() {
|
|
const [, setHoveredIndex] = useRecoilScopedState(
|
|
relationPickerHoverIndexScopedState,
|
|
);
|
|
|
|
const [searchFilter, setSearchFilter] = useRecoilScopedState(
|
|
relationPickerSearchFilterScopedState,
|
|
);
|
|
|
|
const debouncedSetSearchFilter = debounce(setSearchFilter, 100, {
|
|
leading: true,
|
|
});
|
|
|
|
function handleSearchFilterChange(
|
|
event: React.ChangeEvent<HTMLInputElement>,
|
|
) {
|
|
debouncedSetSearchFilter(event.currentTarget.value);
|
|
setHoveredIndex(0);
|
|
}
|
|
|
|
return {
|
|
searchFilter,
|
|
handleSearchFilterChange,
|
|
};
|
|
}
|