mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 02:02:14 +01:00 
			
		
		
		
	Give DMRoomMap an explicit makeShared
Otherwise it will hang on to the old state client on logout.
This commit is contained in:
		
							parent
							
								
									690309adfc
								
							
						
					
					
						commit
						2be1cc9f85
					
				@ -318,7 +318,7 @@ export function startMatrixClient() {
 | 
			
		||||
    Notifier.start();
 | 
			
		||||
    UserActivity.start();
 | 
			
		||||
    Presence.start();
 | 
			
		||||
    DMRoomMap.shared().start();
 | 
			
		||||
    DMRoomMap.makeShared().start();
 | 
			
		||||
 | 
			
		||||
    MatrixClientPeg.start();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -41,15 +41,21 @@ export default class DMRoomMap {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Makes and returns a new shared instance that can then be accessed
 | 
			
		||||
     * with shared(). This returned instance is not automatically started.
 | 
			
		||||
     */
 | 
			
		||||
    static makeShared() {
 | 
			
		||||
        DMRoomMap._sharedInstance = new DMRoomMap(MatrixClientPeg.get());
 | 
			
		||||
        return DMRoomMap._sharedInstance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a shared instance of the class
 | 
			
		||||
     * that uses the singleton matrix client
 | 
			
		||||
     * The shared instance must be started before use.
 | 
			
		||||
     */
 | 
			
		||||
    static shared() {
 | 
			
		||||
        if (!DMRoomMap._sharedInstance) {
 | 
			
		||||
            DMRoomMap._sharedInstance = new DMRoomMap(MatrixClientPeg.get());
 | 
			
		||||
        }
 | 
			
		||||
        return DMRoomMap._sharedInstance;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -63,8 +69,8 @@ export default class DMRoomMap {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _onAccountData(ev) {
 | 
			
		||||
        this.userToRooms = this.matrixClient.getAccountData('m.direct').getContent();
 | 
			
		||||
        if (ev.getType() == 'm.direct') {
 | 
			
		||||
            this.userToRooms = this.matrixClient.getAccountData('m.direct').getContent();
 | 
			
		||||
            this._populateRoomToUser();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user