Add additonal query limits and restrictors for performance.

This commit is contained in:
Patrick Fic
2023-09-18 16:08:20 -07:00
parent 64851047bf
commit 06c35a4ff8
7 changed files with 11 additions and 7 deletions

View File

@@ -33,7 +33,7 @@ const JobSearchSelect = (
useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE);
const executeSearch = (v) => {
if (v && v !== "") callSearch(v);
if (v && v !== "" && v.length >= 3) callSearch(v);
};
const debouncedExecuteSearch = _.debounce(executeSearch, 500);

View File

@@ -21,7 +21,7 @@ const OwnerSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => {
useLazyQuery(SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE);
const executeSearch = (v) => {
callSearch(v);
if (v && v !== "" && v.length >= 3) callSearch(v);
};
const debouncedExecuteSearch = _.debounce(executeSearch, 500);

View File

@@ -106,7 +106,11 @@ export default function OwnersListComponent({
<Input.Search
placeholder={search.search || t("general.labels.search")}
onSearch={(value) => {
search.search = value;
if (value?.length >= 3) {
search.search = value;
} else {
delete search.search;
}
history.push({ search: queryString.stringify(search) });
}}
enterButton

View File

@@ -22,7 +22,7 @@ const VehicleSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => {
] = useLazyQuery(SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE);
const executeSearch = (v) => {
callSearch(v);
if (v && v !== "" && v.length >= 3) callSearch(v);
};
const debouncedExecuteSearch = _.debounce(executeSearch, 500);