From f119bcd5a24154a1f132fd185689f6335b89cc3a Mon Sep 17 00:00:00 2001 From: Evangelos Skopelitis Date: Mon, 10 Jun 2024 11:56:01 -0400 Subject: [PATCH] frontend: MainInfoSection: Correctly handle null backLink This fix explicitly handles the null case in getBackLink() to ensure that no back button will be shown, as defined in MainInfoSectionProps. Fixes: #2033 Signed-off-by: Evangelos Skopelitis --- .../__snapshots__/List.stories.storyshot | 21 +------------------ .../__snapshots__/Settings.stories.storyshot | 21 +------------------ .../MainInfoSection/MainInfoSection.tsx | 4 ++++ frontend/src/components/common/SectionBox.tsx | 2 +- .../CustomResourceDetails.stories.storyshot | 21 +------------------ 5 files changed, 8 insertions(+), 61 deletions(-) diff --git a/frontend/src/components/App/Notifications/__snapshots__/List.stories.storyshot b/frontend/src/components/App/Notifications/__snapshots__/List.stories.storyshot index b2e456f2487..bb95cff9d22 100644 --- a/frontend/src/components/App/Notifications/__snapshots__/List.stories.storyshot +++ b/frontend/src/components/App/Notifications/__snapshots__/List.stories.storyshot @@ -2,26 +2,7 @@ exports[`Storyshots Notifications List 1`] = `
- +
diff --git a/frontend/src/components/App/Settings/__snapshots__/Settings.stories.storyshot b/frontend/src/components/App/Settings/__snapshots__/Settings.stories.storyshot index 0e2b0e9781b..0a21be68cc1 100644 --- a/frontend/src/components/App/Settings/__snapshots__/Settings.stories.storyshot +++ b/frontend/src/components/App/Settings/__snapshots__/Settings.stories.storyshot @@ -2,26 +2,7 @@ exports[`Storyshots Settings General 1`] = `
- +
diff --git a/frontend/src/components/common/Resource/MainInfoSection/MainInfoSection.tsx b/frontend/src/components/common/Resource/MainInfoSection/MainInfoSection.tsx index 6649d35bc7d..3817f44a0fd 100644 --- a/frontend/src/components/common/Resource/MainInfoSection/MainInfoSection.tsx +++ b/frontend/src/components/common/Resource/MainInfoSection/MainInfoSection.tsx @@ -49,6 +49,10 @@ export function MainInfoSection(props: MainInfoSectionProps) { const header = typeof headerSection === 'function' ? headerSection(resource) : headerSection; function getBackLink() { + if (backLink === null) { + return false; + } + if (!!backLink || backLink === '') { return backLink; } diff --git a/frontend/src/components/common/SectionBox.tsx b/frontend/src/components/common/SectionBox.tsx index c48fe34835b..4c777094851 100644 --- a/frontend/src/components/common/SectionBox.tsx +++ b/frontend/src/components/common/SectionBox.tsx @@ -33,7 +33,7 @@ export function SectionBox(props: SectionBoxProps) { return ( <> - {actualBackLink !== undefined && } + {actualBackLink && } {title && titleElem} - +