Просмотр исходного кода

fix(search): search initParams

lind 3 лет назад
Родитель
Сommit
93609ba272
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      src/components/SearchComponent/index.tsx

+ 4 - 3
src/components/SearchComponent/index.tsx

@@ -203,6 +203,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
               f.setFieldState(typeFiled.query('.value'), (state) => {
                 state.componentType = 'TreeSelect';
                 state.dataSource = option;
+                console.log(option, 'optin');
                 state.componentProps = {
                   ..._field.fieldProps,
                   treeNodeFilterProp: 'name',
@@ -396,7 +397,7 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
     if (initParam && initParam[0].terms && initParam[0].terms.length > 1) {
       handleExpand();
     }
-  }, []);
+  }, [initParam]);
   const simpleSchema: ISchema = {
     type: 'object',
     properties: {
@@ -490,10 +491,10 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   };
 
   useEffect(() => {
-    if (defaultParam || initParam) {
+    if (defaultParam) {
       handleSearch();
     }
-  }, [defaultParam, initParam]);
+  }, []);
 
   const handleSaveLog = async () => {
     const value = await form.submit<SearchTermsUI>();