diff --git a/public/app/core/components/NestedFolderPicker/FolderRepo.tsx b/public/app/core/components/NestedFolderPicker/FolderRepo.tsx index 932f33bfabe..153becab1b9 100644 --- a/public/app/core/components/NestedFolderPicker/FolderRepo.tsx +++ b/public/app/core/components/NestedFolderPicker/FolderRepo.tsx @@ -1,3 +1,5 @@ +import { memo } from 'react'; + import { t } from '@grafana/i18n'; import { Badge, Stack } from '@grafana/ui'; import { ManagerKind } from 'app/features/apiserver/types'; @@ -11,7 +13,7 @@ export interface Props { folder?: FolderDTO | DashboardViewItem; } -export function FolderRepo({ folder }: Props) { +export const FolderRepo = memo(function FolderRepo({ folder }: Props) { // skip rendering if: // folder is not present // folder have parentUID @@ -47,7 +49,7 @@ export function FolderRepo({ folder }: Props) { /> ); -} +}); function getShouldSkipRender(folder: FolderDTO | DashboardViewItem | undefined, isProvisionedInstance?: boolean) { // Skip render if parentUID is present, then we should skip rendering. we only display icon for root folders diff --git a/public/app/core/components/NestedFolderPicker/NestedFolderPicker.tsx b/public/app/core/components/NestedFolderPicker/NestedFolderPicker.tsx index 5a4acea4d42..0abd0049c81 100644 --- a/public/app/core/components/NestedFolderPicker/NestedFolderPicker.tsx +++ b/public/app/core/components/NestedFolderPicker/NestedFolderPicker.tsx @@ -233,6 +233,7 @@ export function NestedFolderPicker({ kind: 'folder' as const, title: item.title, uid: item.uid, + parentUID: item.parentUID, }, })) ?? []; } diff --git a/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts b/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts index 86ebf294413..64a56377dc8 100644 --- a/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts +++ b/public/app/core/components/NestedFolderPicker/useFoldersQueryAppPlatform.ts @@ -139,6 +139,7 @@ export function useFoldersQueryAppPlatform({ uid: name, // eslint-disable-next-line @typescript-eslint/consistent-type-assertions managedBy: item.metadata?.annotations?.[AnnoKeyManagerKind] as ManagerKind | undefined, + parentUID: item.parentUID, }, }; diff --git a/public/app/core/components/NestedFolderPicker/useFoldersQueryLegacy.ts b/public/app/core/components/NestedFolderPicker/useFoldersQueryLegacy.ts index a80b22ac254..fa07abccf31 100644 --- a/public/app/core/components/NestedFolderPicker/useFoldersQueryLegacy.ts +++ b/public/app/core/components/NestedFolderPicker/useFoldersQueryLegacy.ts @@ -160,6 +160,7 @@ export function useFoldersQueryLegacy({ title: item.title, uid: item.uid, managedBy: item.managedBy, + parentUID: item.parentUid, }, }; diff --git a/public/app/types/folders.ts b/public/app/types/folders.ts index 4762752f5c0..0e4d15f7971 100644 --- a/public/app/types/folders.ts +++ b/public/app/types/folders.ts @@ -6,6 +6,7 @@ export interface FolderListItemDTO { uid: string; title: string; managedBy?: ManagerKind; + parentUid?: string; } export type FolderParent = Pick;