Browse Source

add collection name validation

tumao 4 years ago
parent
commit
48bbd17cbc
1 changed files with 5 additions and 1 deletions
  1. 5 1
      client/src/pages/seach/VectorSearch.tsx

+ 5 - 1
client/src/pages/seach/VectorSearch.tsx

@@ -194,7 +194,11 @@ const VectorSearch = () => {
   useEffect(() => {
   useEffect(() => {
     if (location.search && collections.length > 0) {
     if (location.search && collections.length > 0) {
       const { collectionName } = parseLocationSearch(location.search);
       const { collectionName } = parseLocationSearch(location.search);
-      setSelectedCollection(collectionName);
+      // collection name validation
+      const isNameValid = collections
+        .map(c => c._name)
+        .includes(collectionName);
+      isNameValid && setSelectedCollection(collectionName);
     }
     }
   }, [location, collections]);
   }, [location, collections]);