mirror of
				https://github.com/vector-im/element-web.git
				synced 2025-11-04 10:11:03 +01:00 
			
		
		
		
	Merge pull request #4039 from matrix-org/jryans/rvs-spam
Only emit in RoomViewStore when state actually changes
This commit is contained in:
		
						commit
						a160fbf0cc
					
				@ -66,6 +66,20 @@ class RoomViewStore extends Store {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _setState(newState) {
 | 
			
		||||
        // If values haven't changed, there's nothing to do.
 | 
			
		||||
        // This only tries a shallow comparison, so unchanged objects will slip
 | 
			
		||||
        // through, but that's probably okay for now.
 | 
			
		||||
        let stateChanged = false;
 | 
			
		||||
        for (const key of Object.keys(newState)) {
 | 
			
		||||
            if (this._state[key] !== newState[key]) {
 | 
			
		||||
                stateChanged = true;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!stateChanged) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._state = Object.assign(this._state, newState);
 | 
			
		||||
        this.__emitChange();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user