Yuki Takei 4 лет назад
Родитель
Сommit
0ab6197c40
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      packages/app/src/stores/search.tsx

+ 3 - 1
packages/app/src/stores/search.tsx

@@ -69,8 +69,10 @@ export const useSWRxFullTextSearch = (
   };
   const rawQuery = createSearchQuery(keyword ?? '', fixedConfigurations.includeTrashPages, fixedConfigurations.includeUserPages);
 
+  const isKeywordValid = keyword != null && keyword.length > 0;
+
   const swrResult = useSWRImmutable(
-    keyword == null ? null : ['/search', keyword, fixedConfigurations, termNumber],
+    isKeywordValid ? ['/search', keyword, fixedConfigurations, termNumber] : null,
     (endpoint, keyword, fixedConfigurations) => {
       const {
         limit, offset, sort, order,