Skip to content

Commit

Permalink
Prevent reload when click in the sameTab
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanchez91 committed Dec 20, 2019
1 parent 71f0ef2 commit 7e1deb1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions public/directives/wz-tabs-eui/components/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ export class Tabs extends Component {
};

renderTabs() {
return this.tabs.map((tab, index) => (
<EuiTab
onClick={() => this.onSelectedTabChanged(tab.id)}
isSelected={tab.id === this.state.selectedTabId}
return this.tabs.map((tab, index) => {
const selectedTabId = tab.id === this.state.selectedTabId;
return (<EuiTab
onClick={() => selectedTabId ? null : this.onSelectedTabChanged(tab.id)}
isSelected={selectedTabId}
key={index}
>
{tab.name}
</EuiTab>
));
)});
}

render() {
Expand Down

0 comments on commit 7e1deb1

Please sign in to comment.