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

Merge remote-tracking branch 'origin/dev/6.1.x'

Yuki Takei 2 лет назад
Родитель
Сommit
524274839b
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 2
      apps/app/src/components/SearchTypeahead.tsx
  2. 1 0
      apps/app/src/stores/search.tsx

+ 1 - 2
apps/app/src/components/SearchTypeahead.tsx

@@ -64,7 +64,7 @@ const SearchTypeahead: ForwardRefRenderFunction<IFocusable, Props> = (props: Pro
   const [searchKeyword, setSearchKeyword] = useState('');
   const [isForcused, setFocused] = useState(false);
 
-  const { data: searchResult, error: searchError } = useSWRxSearch(
+  const { data: searchResult, error: searchError, isLoading } = useSWRxSearch(
     disableIncrementalSearch ? null : searchKeyword,
     null,
     { limit: 10 },
@@ -219,7 +219,6 @@ const SearchTypeahead: ForwardRefRenderFunction<IFocusable, Props> = (props: Pro
     );
   }, [disableIncrementalSearch, helpElement, input, isForcused]);
 
-  const isLoading = searchResult !== undefined && searchError == null;
   const isOpenAlways = helpElement != null;
 
   return (

+ 1 - 0
apps/app/src/stores/search.tsx

@@ -86,6 +86,7 @@ export const useSWRxSearch = (
       ).then(result => result as IFormattedSearchResult);
     },
     {
+      keepPreviousData: true,
       revalidateOnFocus: false,
     },
   );