Shun Miyazawa 4 лет назад
Родитель
Сommit
4bf83be578
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      packages/app/src/stores/user-group.tsx

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

@@ -23,8 +23,9 @@ export const useSWRxUserGroupList = (initialData?: IUserGroupHasId[]): SWRRespon
 export const useSWRxChildUserGroupList = (
     parentIds: string[] | undefined, includeGrandChildren?: boolean, initialData?: IUserGroupHasId[],
 ): SWRResponse<IUserGroupHasId[], Error> => {
+  const shouldFetch = parentIds != null && parentIds.join() !== '';
   return useSWRImmutable<IUserGroupHasId[], Error>(
-    parentIds != null ? ['/user-groups/children', parentIds.join(), includeGrandChildren] : null,
+    shouldFetch ? ['/user-groups/children', parentIds.join(), includeGrandChildren] : null,
     (endpoint, parentIds, includeGrandChildren) => apiv3Get<ChildUserGroupListResult>(
       endpoint, { parentIds, includeGrandChildren },
     ).then(result => result.data.childUserGroups),