fix(player): only display tabs that are created

This commit is contained in:
nick-delirium 2023-05-16 11:43:31 +02:00
parent e58d7fc292
commit dcfd6a553d
2 changed files with 6 additions and 2 deletions

View file

@ -23,13 +23,13 @@ function SubHeader(props) {
const {
width,
height,
location: currentLocation,
endTime,
tabStates,
currentTab,
tabs,
} = store.get();
const currentLocation = tabStates[currentTab]?.location || ''
const resourceList = tabStates[currentTab]?.resourceList || []
const exceptionsList = tabStates[currentTab]?.exceptionsList || []
const eventsList = tabStates[currentTab]?.eventsList || []

View file

@ -166,6 +166,11 @@ export default class MessageManager {
this.screen.cursor.shake();
}
const activeTabs = this.state.get().tabs
if (tabId && !activeTabs.includes(tabId)) {
this.state.update({ tabs: activeTabs.concat(tabId) })
}
if (tabId && this.activeTab !== tabId) {
this.state.update({ currentTab: tabId })
this.activeTab = tabId
@ -210,7 +215,6 @@ export default class MessageManager {
}
switch (msg.tp) {
case MType.TabChange:
this.state.update({ tabs: this.state.get().tabs.concat(msg.tabId) })
this.activeTabManager.append(msg)
break;
case MType.MouseThrashing: