From 62aef0bc45a197dbfe9029bf99c61e6bf2f38835 Mon Sep 17 00:00:00 2001 From: Ashwin Pc Date: Tue, 13 Sep 2022 21:07:43 +0000 Subject: [PATCH] Fixes management app breadcrumb error Signed-off-by: Ashwin Pc --- .../empty_index_pattern_prompt.tsx | 5 ++++- .../components/index_pattern_table/index_pattern_table.tsx | 6 +++++- .../management/public/components/landing/landing.tsx | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx index bf6c069ac89a..42b5e4645c84 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_index_pattern_prompt/empty_index_pattern_prompt.tsx @@ -37,6 +37,7 @@ import { EuiPageContent, EuiSpacer, EuiText, EuiFlexItem, EuiFlexGroup } from '@ import { EuiDescriptionListTitle } from '@elastic/eui'; import { EuiDescriptionListDescription, EuiDescriptionList } from '@elastic/eui'; import { EuiLink } from '@elastic/eui'; +import { useMount } from 'react-use'; import { getListBreadcrumbs } from '../../breadcrumbs'; import { IndexPatternCreationOption } from '../../types'; import { CreateButton } from '../../create_button'; @@ -56,7 +57,9 @@ export const EmptyIndexPatternPrompt = ({ docLinksIndexPatternIntro, setBreadcrumbs, }: Props) => { - setBreadcrumbs(getListBreadcrumbs()); + useMount(() => { + setBreadcrumbs(getListBreadcrumbs()); + }); return ( { const [isLoadingSources, setIsLoadingSources] = useState(true); const [isLoadingIndexPatterns, setIsLoadingIndexPatterns] = useState(true); - setBreadcrumbs(getListBreadcrumbs()); + useMount(() => { + setBreadcrumbs(getListBreadcrumbs()); + }); + useEffect(() => { (async function () { const options = await indexPatternManagementStart.creation.getIndexPatternCreationOptions( diff --git a/src/plugins/management/public/components/landing/landing.tsx b/src/plugins/management/public/components/landing/landing.tsx index 1ef25934d103..8c44f014d8e8 100644 --- a/src/plugins/management/public/components/landing/landing.tsx +++ b/src/plugins/management/public/components/landing/landing.tsx @@ -39,6 +39,7 @@ import { EuiText, EuiTitle, } from '@elastic/eui'; +import { useMount } from 'react-use'; interface ManagementLandingPageProps { version: string; @@ -46,7 +47,9 @@ interface ManagementLandingPageProps { } export const ManagementLandingPage = ({ version, setBreadcrumbs }: ManagementLandingPageProps) => { - setBreadcrumbs(); + useMount(() => { + setBreadcrumbs(); + }); return (