From b31b82cbee62d120c77e2b98072687f995bf0b1b Mon Sep 17 00:00:00 2001 From: Evangelos Skopelitis Date: Fri, 14 Jun 2024 10:27:53 -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.List.stories.storyshot | 19 +------------------ .../Settings.General.stories.storyshot | 19 +------------------ .../MainInfoSection/MainInfoSection.tsx | 4 ++++ ...mResourceDetails.NoError.stories.storyshot | 19 +------------------ 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/frontend/src/components/App/Notifications/__snapshots__/List.List.stories.storyshot b/frontend/src/components/App/Notifications/__snapshots__/List.List.stories.storyshot index d0e366c45e8..f45bf2356de 100644 --- a/frontend/src/components/App/Notifications/__snapshots__/List.List.stories.storyshot +++ b/frontend/src/components/App/Notifications/__snapshots__/List.List.stories.storyshot @@ -1,22 +1,5 @@
- +
diff --git a/frontend/src/components/App/Settings/__snapshots__/Settings.General.stories.storyshot b/frontend/src/components/App/Settings/__snapshots__/Settings.General.stories.storyshot index bafc228d8d6..a2b8501da90 100644 --- a/frontend/src/components/App/Settings/__snapshots__/Settings.General.stories.storyshot +++ b/frontend/src/components/App/Settings/__snapshots__/Settings.General.stories.storyshot @@ -1,22 +1,5 @@
- +
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/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot b/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot index a0ce30bc8b1..7df7c9b663d 100644 --- a/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot +++ b/frontend/src/components/crd/__snapshots__/CustomResourceDetails.NoError.stories.storyshot @@ -8,24 +8,7 @@
- +