From cbb2b48dd8c323ecab0f2b39e0c6bc074175d8c2 Mon Sep 17 00:00:00 2001 From: Anton Standrik Date: Thu, 26 Jun 2025 21:53:42 +0300 Subject: [PATCH] fix: aibutton placeholder header --- src/components/ComponentsProvider/registry.ts | 6 ++++++ src/containers/Header/Header.tsx | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ComponentsProvider/registry.ts b/src/components/ComponentsProvider/registry.ts index 14468cde8..f16dd6868 100644 --- a/src/components/ComponentsProvider/registry.ts +++ b/src/components/ComponentsProvider/registry.ts @@ -16,6 +16,11 @@ export class Registry { return this.entities[id]; } + has(id: Id): boolean { + const entity = this.entities[id]; + return entity && entity.name !== 'EmptyPlaceholder'; + } + register(id: Id, entity: T): Registry { this.entities[id] = entity; @@ -31,4 +36,5 @@ type ComponentType = export interface ComponentsRegistryTemplate> { set(id: Id, entity: ComponentType): this; get(id: Id): ComponentType; + has(id: Id): boolean; } diff --git a/src/containers/Header/Header.tsx b/src/containers/Header/Header.tsx index 3fedfb3fb..09c3f0b68 100644 --- a/src/containers/Header/Header.tsx +++ b/src/containers/Header/Header.tsx @@ -39,8 +39,6 @@ function Header() { const isAddClusterAvailable = useAddClusterFeatureAvailable() && uiFactory.onAddCluster !== undefined; - const AIAssistantButton = componentsRegistry.get('AIAssistantButton'); - const breadcrumbItems = React.useMemo(() => { let options = {...pageBreadcrumbsOptions, singleClusterMode}; @@ -79,7 +77,8 @@ function Header() { ); } - if (AIAssistantButton) { + if (componentsRegistry.has('AIAssistantButton')) { + const AIAssistantButton = componentsRegistry.get('AIAssistantButton'); elements.push(); }