@@ -23,7 +23,7 @@ export class ConversationsComponent implements OnInit, OnDestroy {
2323 conversationsDataSource : any ;
2424 conversations_json : Array < object > ;
2525 conversations_json_backup : Array < object > ;
26- filterConversationText : string ;
26+ filterConversationText = '' ;
2727
2828 @ViewChild ( MatPaginator ) paginator : MatPaginator ;
2929
@@ -38,7 +38,8 @@ export class ConversationsComponent implements OnInit, OnDestroy {
3838 getConversations ( ) {
3939 this . apiService . requestConversations ( ) . subscribe ( conversations => {
4040 if ( conversations ) {
41- this . conversations_json = this . conversations_json_backup = conversations ;
41+ this . conversations_json = conversations . slice ( ) ;
42+ this . conversations_json_backup = JSON . parse ( JSON . stringify ( this . conversations_json ) ) ;
4243 this . conversationsDataSource = new MatTableDataSource ( this . conversations_json ) ;
4344 this . conversationsDataSource . paginator = this . paginator ;
4445 this . applyConversationsFilter ( this . filterConversationText ) ;
@@ -72,7 +73,7 @@ export class ConversationsComponent implements OnInit, OnDestroy {
7273
7374 openConversationChat ( conversation_id : string ) {
7475 // tslint:disable-next-line: max-line-length
75- this . sharedDataService . setSharedData ( 'conversation_json' , this . conversations_json . filter ( conversations => conversations [ 'sender_id' ] === conversation_id ) , constant . MODULE_COMMON ) ;
76+ this . sharedDataService . setSharedData ( 'conversation_json' , this . conversations_json_backup . filter ( conversations => conversations [ 'sender_id' ] === conversation_id ) , constant . MODULE_COMMON ) ;
7677 this . _router . navigate ( [ '/home/conversations/' + conversation_id ] ) ;
7778 }
7879
@@ -81,7 +82,7 @@ export class ConversationsComponent implements OnInit, OnDestroy {
8182 }
8283
8384 ngOnDestroy ( ) : void {
84- this . apiService . forceConversationsCacheReload ( 'finish' ) ;
85+ this . apiService . forceConversationsCacheReload ( ) ;
8586 }
8687
8788}
0 commit comments