diff --git a/src/editor/editor.tsx b/src/editor/editor.tsx index 5b5a803adabf2893f7bb66f57c9b466f6a18bd34..ef9a3e8a8f3b241e099768409bfdb00d869371fb 100644 --- a/src/editor/editor.tsx +++ b/src/editor/editor.tsx @@ -462,9 +462,12 @@ export class Editor extends React.PureComponent<any, stateTypes> { private deleteSpace(spaceId: string): Promise<void> { return deleteGraphJson(spaceId).then(() => { // Select first space in list if available, otherwise select defaul space (which will be created) + const remainingSpacesList: string[] = this.state.spaces.filter( + (space: string) => space != spaceId + ); const selectSpaceId: string = - this.state.spaces.length > 0 - ? this.state.spaces[0] + remainingSpacesList.length > 0 + ? remainingSpacesList[0] : Config.SPACE; this.loadSpace(selectSpaceId);