Remove autocomplete from ai roadmap search

pull/8331/head
Kamran Ahmed 1 month ago
parent 1085c33dc4
commit 8878d04f98
  1. 48
      src/components/GenerateRoadmap/AITermSuggestionInput.tsx

@ -128,32 +128,32 @@ export function AITermSuggestionInput(props: AITermSuggestionInputProps) {
return allRoadmaps;
};
useEffect(() => {
if (debouncedSearchValue.length === 0 || isFirstRender.current) {
setSearchResults([]);
return;
}
// useEffect(() => {
// if (debouncedSearchValue.length === 0 || isFirstRender.current) {
// setSearchResults([]);
// return;
// }
setIsActive(true);
setIsLoading(true);
loadTopAIRoadmapTerm()
.then((results) => {
const normalizedSearchText = debouncedSearchValue.trim().toLowerCase();
const matchingOfficialRoadmaps = officialRoadmaps.filter((roadmap) => {
return (
roadmap.title.toLowerCase().indexOf(normalizedSearchText) !== -1
);
});
// setIsActive(true);
// setIsLoading(true);
// loadTopAIRoadmapTerm()
// .then((results) => {
// const normalizedSearchText = debouncedSearchValue.trim().toLowerCase();
// const matchingOfficialRoadmaps = officialRoadmaps.filter((roadmap) => {
// return (
// roadmap.title.toLowerCase().indexOf(normalizedSearchText) !== -1
// );
// });
setSearchResults(
[...matchingOfficialRoadmaps, ...results]?.slice(0, 5) || [],
);
setActiveCounter(0);
})
.finally(() => {
setIsLoading(false);
});
}, [debouncedSearchValue]);
// setSearchResults(
// [...matchingOfficialRoadmaps, ...results]?.slice(0, 5) || [],
// );
// setActiveCounter(0);
// })
// .finally(() => {
// setIsLoading(false);
// });
// }, [debouncedSearchValue]);
useEffect(() => {
if (isFirstRender.current) {

Loading…
Cancel
Save