Ver Fonte

Do not request when an empty string is entered

Shun Miyazawa há 3 anos atrás
pai
commit
bd2341480b
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      packages/app/src/stores/user.tsx

+ 1 - 1
packages/app/src/stores/user.tsx

@@ -38,7 +38,7 @@ type usernameResult = {
 
 export const useSWRxUsernames = (q: string, offset?: number, limit?: number, options?: usernameRequestOptions): SWRResponse<usernameResult, Error> => {
   return useSWRImmutable(
-    q != null ? ['/users/usernames', q, offset, limit, options] : null,
+    (q != null && q.trim() !== '') ? ['/users/usernames', q, offset, limit, options] : null,
     (endpoint, q, offset, limit, options) => apiv3Get(endpoint, {
       q, offset, limit, options,
     }).then(result => result.data),