Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-13047-fixed-1762181966107.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

IAM Child Account - user not found error handling ([#13047](https://github.com/linode/manager/pull/13047))
14 changes: 10 additions & 4 deletions packages/manager/src/routes/IAM/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { rootRoute } from '../root';
import { IAMRoute } from './IAMRoute';

import type { TableSearchParams } from '../types';
import type { User } from '@linode/api-v4';

interface IamEntitiesSearchParams {
selectedRole?: string;
Expand Down Expand Up @@ -175,12 +176,17 @@ const iamUserNameRoute = createRoute({
const isChildAccount = profile?.user_type === 'child';

if (!profile.restricted && isChildAccount) {
const user = await context.queryClient.ensureQueryData(
queryOptions(accountQueries.users._ctx.user(username))
);
let user: undefined | User;
try {
user = await context.queryClient.ensureQueryData(
queryOptions(accountQueries.users._ctx.user(username))
);
} catch (error) {
return error[0].reason;
}

const isChildAccount = profile?.user_type === 'child';
const isDelegateUser = user?.user_type === 'delegate';
const isDelegateUser = user.user_type === 'delegate';

// Determine if the current account is a child account with isIAMDelegationEnabled enabled
// If so, we need to hide 'View User Details' and 'Account Delegations' tabs for delegate users
Expand Down