Calling search results without parameters (#2056)

Calling search results without parameters leads to "Cannot read properties of undefined (reading 'length')" error. It does not matter which search mask is called.
This commit is contained in:
Florian Scholdei
2022-06-08 13:43:45 +02:00
committed by GitHub
parent 1f5ebc04d6
commit d1c355b213
2 changed files with 3 additions and 1 deletions

View File

@@ -0,0 +1,2 @@
- type: fixed
description: Calling search results without parameters ([#2056](https://github.com/scm-manager/scm-manager/pull/2056))

View File

@@ -113,7 +113,7 @@ export const useSearch = (query: string, optionParam = defaultSearchOptions): Ap
["search", options.type, queryParams],
() => apiClient.get(`${link}?${createQueryString(queryParams)}`).then((response) => response.json()),
{
enabled: query.length > 1,
enabled: query?.length > 1,
}
);
};