@@ -269,7 +269,7 @@ qx.Class.define("osparc.study.Conversations", {
269269 const conversationId = conversationData [ "conversationId" ] ;
270270 conversationPage = new osparc . conversation . Conversation ( studyData , conversationId ) ;
271271 conversationPage . setLabel ( conversationData [ "name" ] ) ;
272- conversationPage . addListener ( "conversationDeleted" , ( ) => this . __removeConversationPage ( conversationData ) ) ;
272+ conversationPage . addListener ( "conversationDeleted" , ( ) => this . __removeConversationPage ( conversationData , true ) ) ;
273273 } else {
274274 // create a temporary conversation
275275 conversationPage = new osparc . conversation . Conversation ( studyData ) ;
@@ -329,17 +329,22 @@ qx.Class.define("osparc.study.Conversations", {
329329 conversationsLayout . getChildControl ( "bar" ) . add ( this . __newConversationButton ) ;
330330 } ,
331331
332- __removeConversationPage : function ( conversationData ) {
332+ __removeConversationPage : function ( conversationData , changeSelection = false ) {
333333 const conversationId = conversationData [ "conversationId" ] ;
334334 const conversation = this . __getConversation ( conversationId ) ;
335335 if ( conversation ) {
336336 const conversationsLayout = this . getChildControl ( "conversations-layout" ) ;
337337 conversationsLayout . remove ( conversation ) ;
338338 this . __conversations = this . __conversations . filter ( c => c !== conversation ) ;
339339
340+ changeSelection
341+
340342 const conversationPages = conversationsLayout . getSelectables ( ) ;
341343 if ( conversationPages . length ) {
342- conversationsLayout . setSelection ( [ conversationPages [ 0 ] ] ) ;
344+ if ( changeSelection ) {
345+ // change selection to the first conversation
346+ conversationsLayout . setSelection ( [ conversationPages [ 0 ] ] ) ;
347+ }
343348 } else {
344349 // no conversations left, add a temporary one
345350 this . __addTempConversationPage ( ) ;
0 commit comments