Skip to content

Commit

Permalink
fix performance problem
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-takei committed Mar 30, 2022
1 parent b8d4bde commit 0ab6197
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/app/src/stores/search.tsx
Expand Up @@ -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,
Expand Down

0 comments on commit 0ab6197

Please sign in to comment.