Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
label update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sugan G authored and Sugan G committed Oct 31, 2023
1 parent de5bfb9 commit a50403b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/terra-tabs/src/common-tabs/_Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,16 @@ class Tabs extends React.Component {
const prevTab = prevProps.tabData.find((tab) => tab.isSelected === true);
const currTab = this.props.tabData.find((tab) => tab.isSelected === true);
const prevtabKeys = [];
const prevtabLabels = [];
prevProps.tabData.forEach(child => {
prevtabKeys.push(child.id);
prevtabLabels.push(child.label);
});
const curtabKeys = [];
const curtabLabels = [];
this.props.tabData.forEach(child => {
curtabKeys.push(child.id);
curtabLabels.push(child.label);
});

// Allow dynamic addition of tabs.
Expand All @@ -175,8 +179,10 @@ class Tabs extends React.Component {
let isTabEqual = false;
for (let i = 0; i < curtabKeys.length; i += 1) {
const prevKey = prevtabKeys[i];
const prevLabel = prevtabLabels[i];
const curKey = curtabKeys[i];
if (prevKey !== curKey) {
const curLabel = curtabLabels[i];
if (prevKey !== curKey || prevLabel !== curLabel) {
isTabEqual = true;
}
}
Expand Down

0 comments on commit a50403b

Please sign in to comment.