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

Revert "[terra-tabs] Fixes tab label update" #1872

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/terra-tabs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

## Unreleased

* Fixed
* Fixes issue where tab label fails to get updated due to
having the same key before and after tab label update.

## 7.11.1 - (October 25, 2023)

* Fixed
Expand Down
8 changes: 1 addition & 7 deletions packages/terra-tabs/src/common-tabs/_Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,12 @@ 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 @@ -179,10 +175,8 @@ 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];
const curLabel = curtabLabels[i];
if (prevKey !== curKey || prevLabel !== curLabel) {
if (prevKey !== curKey) {
isTabEqual = true;
}
}
Expand Down
Loading