diff --git a/.changeset/angry-falcons-wait.md b/.changeset/angry-falcons-wait.md new file mode 100644 index 00000000000..c9d30a106b5 --- /dev/null +++ b/.changeset/angry-falcons-wait.md @@ -0,0 +1,5 @@ +--- +"@wso2is/features": patch +--- + +Fix error during user fetch diff --git a/features/admin.groups.v1/components/edit-group/edit-group.tsx b/features/admin.groups.v1/components/edit-group/edit-group.tsx index 275692dc796..efa376051de 100644 --- a/features/admin.groups.v1/components/edit-group/edit-group.tsx +++ b/features/admin.groups.v1/components/edit-group/edit-group.tsx @@ -16,7 +16,6 @@ * under the License. */ -import useUIConfig from "../../../admin.core.v1/hooks/use-ui-configs"; import { hasRequiredScopes, isFeatureEnabled } from "@wso2is/core/helpers"; import { AlertLevels, FeatureAccessConfigInterface, SBACInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; @@ -32,6 +31,7 @@ import { BasicGroupDetails } from "./edit-group-basic"; import { EditGroupRoles } from "./edit-group-roles"; import { GroupRolesV1List } from "./edit-group-roles-v1"; import { GroupUsersList } from "./edit-group-users"; +import useUIConfig from "../../../admin.core.v1/hooks/use-ui-configs"; import { FeatureConfigInterface } from "../../../admin.core.v1/models"; import { AppState } from "../../../admin.core.v1/store"; import { getUsersList } from "../../../admin.users.v1/api"; @@ -140,7 +140,7 @@ export const EditGroup: FunctionComponent = (props: EditGroupPro getUsersList(null, null, null, null, userstore) .then((response: UserListInterface) => { setUsersList(response.Resources); - setSelectedUsersList(filterUsersList([ ...response.Resources ])); + setSelectedUsersList(filterUsersList(response.Resources)); }) .catch((error: AxiosError) => { if (error?.response?.data?.description) { @@ -176,7 +176,7 @@ export const EditGroup: FunctionComponent = (props: EditGroupPro */ const filterUsersList = (usersToFilter: UserBasicInterface[]): UserBasicInterface[] => { - if (!group?.members || !Array.isArray(group.members) || group.members.length < 1) { + if (!group?.members || !Array.isArray(group.members) || group.members.length < 1 || !usersToFilter) { return; }