Better state handling.

master
Håvar Aambø Fosstveit 2019-11-04 23:37:10 +01:00
parent d45fd32a78
commit cd5055c00e
1 changed files with 12 additions and 8 deletions

View File

@ -441,6 +441,9 @@ export default class RoomClient
if (!displayName) if (!displayName)
displayName = 'Guest'; displayName = 'Guest';
store.dispatch(
stateActions.setDisplayNameInProgress(true));
try try
{ {
await this.sendRequest('changeDisplayName', { displayName }); await this.sendRequest('changeDisplayName', { displayName });
@ -461,11 +464,10 @@ export default class RoomClient
type : 'error', type : 'error',
text : 'An error occured while changing your display name.' text : 'An error occured while changing your display name.'
})); }));
// We need to refresh the component for it to render the previous
// displayName again.
store.dispatch(stateActions.setDisplayName());
} }
store.dispatch(
stateActions.setDisplayNameInProgress(false));
} }
async changePicture(picture) async changePicture(picture)
@ -1244,8 +1246,6 @@ export default class RoomClient
text : 'You are disconnected.' text : 'You are disconnected.'
})); }));
store.dispatch(stateActions.setRoomState('closed'));
this.close(); this.close();
} }
@ -1266,8 +1266,6 @@ export default class RoomClient
text : 'You are disconnected.' text : 'You are disconnected.'
})); }));
store.dispatch(stateActions.setRoomState('closed'));
this.close(); this.close();
}); });
@ -1479,6 +1477,8 @@ export default class RoomClient
store.dispatch( store.dispatch(
stateActions.addLobbyPeer(peerId)); stateActions.addLobbyPeer(peerId));
store.dispatch(
stateActions.setToolbarsVisible(true));
store.dispatch(requestActions.notify( store.dispatch(requestActions.notify(
{ {
@ -1633,6 +1633,8 @@ export default class RoomClient
store.getState().toolarea.currentToolTab !== 'chat') store.getState().toolarea.currentToolTab !== 'chat')
) // Make sound ) // Make sound
{ {
store.dispatch(
stateActions.setToolbarsVisible(true));
this._soundNotification(); this._soundNotification();
} }
@ -1656,6 +1658,8 @@ export default class RoomClient
store.getState().toolarea.currentToolTab !== 'files') store.getState().toolarea.currentToolTab !== 'files')
) // Make sound ) // Make sound
{ {
store.dispatch(
stateActions.setToolbarsVisible(true));
this._soundNotification(); this._soundNotification();
} }