Skip to content

Commit bf21743

Browse files
committed
clean up buildTab
1 parent 8edf33c commit bf21743

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/globals.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ export const tabNames: any = {
99
};
1010

1111
export const buildTab = (entry: any, tab: string) => {
12+
const tabEntry = componentTabs[entry.data.id]
13+
1214
// if no dictionary entry exists, and tab data exists
13-
if(componentTabs[entry.data.id] === undefined && tab) {
14-
componentTabs[entry.data.id] = [tab];
15+
if(tabEntry === undefined && tab) {
16+
componentTabs[entry.data.id] = [tab]
1517
// if dictionary entry & tab data exists, and entry does not include tab
16-
} else if (componentTabs[entry.data.id] && tab && !componentTabs[entry.data.id].includes(tab)) {
17-
componentTabs[entry.data.id] = [...componentTabs[entry.data.id], tab];
18+
} else if (tabEntry && tab && !tabEntry.includes(tab)) {
19+
componentTabs[entry.data.id] = [...tabEntry, tab];
1820
}
1921
}
2022

0 commit comments

Comments
 (0)