소스 검색

search-input runtime-error fix

daviddeepan 1 년 전
부모
커밋
09c07e58e6
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx

+ 5 - 2
web/apps/photos/src/components/Search/SearchBar/searchInput/index.tsx

@@ -56,8 +56,11 @@ export default function SearchInput(props: Iprops) {
     const [value, setValue] = useState<SearchOption>(null);
     const appContext = useContext(AppContext);
     const handleChange = (value: SearchOption) => {
-        setValue(value);
-        setQuery(value.label);
+        if (value) {
+            setValue(value);
+            setQuery(value.label);
+        }
+
         blur();
     };
     const handleInputChange = (value: string, actionMeta: InputActionMeta) => {