From 4f45570afaa38653514c113d4cc605b4f95474d4 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 16 Sep 2022 03:10:07 -0700 Subject: [PATCH] Fixes management app breadcrumb error (#2344) (#2377) Signed-off-by: Ashwin Pc Signed-off-by: Ashwin Pc (cherry picked from commit b5d529a54eb051021e10009b0c4959d946615569) Co-authored-by: Ashwin P Chandran --- .../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 (