Skip to content

Commit

Permalink
Merge pull request #88 from qua-platform/bugfix/remove-all-open-tabs-…
Browse files Browse the repository at this point in the history
…before-opening-a-new-one

Remove all open tabs before opening a new one
  • Loading branch information
nulinspiratie authored Sep 24, 2024
2 parents 445e8dc + 7e13a68 commit 9ae7fef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/routing/flexLayout/FlexLayoutBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ export default class FlexLayoutBuilder {
}
this._addNode(key);
}

removeAllOpenTabs() {
const allTabs = this._getAllTabs();
console.log(allTabs);
allTabs.forEach((tab) => {
this.model.doAction(Actions.deleteTab(tab.getId()));
});
}
}

function getChildrenFromNode(node: Node): Array<Node> {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/routing/flexLayout/FlexLayoutContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function FlexLayoutContextProvider(props: PropsWithChildren<ReactNode | R

const openTab = useCallback((tab: ModuleKey) => {
// navigate(APP_URL);
LayoutBuilder.current.removeAllOpenTabs();
LayoutBuilder.current.openNewTab(tab);
setModel(LayoutBuilder.current.model);
setActiveTab(tab);
Expand Down

0 comments on commit 9ae7fef

Please sign in to comment.