Browse Source

fix consistency level not set on query page

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 1 year ago
parent
commit
f7f783a00a

+ 5 - 2
client/src/hooks/Query.ts

@@ -6,7 +6,7 @@ import { CollectionFullObject, FieldObject } from '@server/types';
 export const useQuery = (params: {
   collection: CollectionFullObject;
   fields: FieldObject[];
-  consistencyLevel?: string;
+  consistencyLevel: string;
   onQueryStart: Function;
   onQueryEnd?: Function;
   onQueryFinally?: Function;
@@ -18,7 +18,7 @@ export const useQuery = (params: {
     onQueryStart,
     onQueryEnd,
     onQueryFinally,
-    consistencyLevel,
+    consistencyLevel
   } = params;
 
   // states
@@ -160,6 +160,9 @@ export const useQuery = (params: {
       return;
     }
 
+    // reset
+    reset();
+
     // get count;
     count();
     // do the query

+ 2 - 1
client/src/pages/databases/collections/data/CollectionData.tsx

@@ -99,7 +99,7 @@ const CollectionData = (props: CollectionDataProps) => {
   };
   const handlePageChange = async (e: any, page: number) => {
     // do the query
-    await query(page);
+    await query(page, consistencyLevel);
     // update page number
     setCurrentPage(page);
   };
@@ -145,6 +145,7 @@ const CollectionData = (props: CollectionDataProps) => {
     count,
   } = useQuery({
     collection,
+    consistencyLevel,
     fields,
     onQueryStart: (expr: string = '') => {
       setTableLoading(true);