Skip to content

Commit 570844a

Browse files
committed
tab safety
1 parent b76477c commit 570844a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

client/src/components/tabwindow/TabWindow.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,21 @@ class TabWindow extends Component {
6161

6262
const hiddenNavbar = this.props.navbarDetails === false && pages.length === 1;
6363

64+
let tabToRender = this.props.currentTab;
65+
6466
// safety check, current tab should never be higher than the amount of tabs
6567
if (this.props.currentTab >= pages.length) {
6668
reportVital(`metrics:errorinfo:tabwindow currentTab is higher than the amount of tabs. Tab: ${this.props.currentTab}, pages: ${pages.length}`);
6769
setTab(0);
70+
tabToRender = 0;
6871
}
6972

7073
return (
7174
<div className="flex flex-col-reverse bg-gray-800 bg-opacity-25 text-white h-screen w-screen">
7275
<main className="flex justify-center overflow-x-hidden overflow-y-auto w-full h-full backdrop-blur">
7376
<div className="content-wrapper">
7477
<ServerConnectionWarning />
75-
{pages[this.props.currentTab].content}
78+
{pages[tabToRender].content}
7679
</div>
7780
</main>
7881

0 commit comments

Comments
 (0)