Skip to content

Commit 4e1b023

Browse files
authored
Merge pull request RedHatInsights#259 from apinkert/fix-tabs
Fix tab behavior with the VA tab enabled
2 parents cac2b82 + a7401c5 commit 4e1b023

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/components/HelpPanel/HelpPanelCustomTabs.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,18 @@ const HelpPanelCustomTabs = React.forwardRef<HelpPanelCustomTabsRef>(
554554

555555
useEffect(() => {
556556
// When baseTabs change (e.g., feature flag toggle), update activeTab if necessary
557-
if (!baseTabs.find((tab) => tab.id === activeTab.id)) {
557+
// Only reset if the current active tab is a base tab (not closeable) and no longer available
558+
if (
559+
!activeTab.closeable &&
560+
!baseTabs.find((tab) => tab.id === activeTab.id)
561+
) {
558562
// Current active tab is no longer available, default to Learn tab
559563
const learnTab = baseTabs.find((tab) => tab.tabType === TabType.learn);
560564
if (learnTab) {
561565
setActiveTab(learnTab);
562566
}
563567
}
564-
}, [baseTabs, activeTab.id]);
568+
}, [baseTabs, activeTab.id, activeTab.closeable]);
565569

566570
useEffect(() => {
567571
// Ensure the Add tab button has a stable OUIA id

0 commit comments

Comments
 (0)