( state: RightSidebarLayoutState, tab: TabType )
| 561 | * Select an existing tab anywhere in the layout, or add it to the focused tabset if missing. |
| 562 | */ |
| 563 | export function selectOrAddTab( |
| 564 | state: RightSidebarLayoutState, |
| 565 | tab: TabType |
| 566 | ): RightSidebarLayoutState { |
| 567 | const found = collectAllTabsWithTabset(state.root).find((t) => t.tab === tab); |
| 568 | if (found) { |
| 569 | return selectTabInTabset(setFocusedTabset(state, found.tabsetId), found.tabsetId, found.tab); |
| 570 | } |
| 571 | |
| 572 | return addTabToFocusedTabset(state, tab); |
| 573 | } |
| 574 | |
| 575 | /** |
| 576 | * Move a tab from one tabset to another. |
no test coverage detected