also forward actions from room dispatcher to global one

avoiding replay if the action would be forwarded back to
the same room dispatcher

also some fixing & renaming in OpenRoomsStore
This commit is contained in:
Bruno Windels 2018-11-22 12:23:07 +00:00
parent 2ceef00944
commit fbfbefe4fe
4 changed files with 105 additions and 72 deletions

View file

@ -28,7 +28,7 @@ import OpenRoomsStore from './stores/OpenRoomsStore';
class ActiveRoomObserver {
constructor() {
this._listeners = {};
const roomStore = OpenRoomsStore.getCurrentRoomStore();
const roomStore = OpenRoomsStore.getActiveRoomStore();
this._activeRoomId = roomStore && roomStore.getRoomId();
// TODO: We could self-destruct when the last listener goes away, or at least
// stop listening.
@ -67,7 +67,7 @@ class ActiveRoomObserver {
// emit for the old room ID
if (this._activeRoomId) this._emit(this._activeRoomId);
const activeRoomStore = OpenRoomsStore.getCurrentRoomStore();
const activeRoomStore = OpenRoomsStore.getActiveRoomStore();
// update our cache
this._activeRoomId = activeRoomStore && activeRoomStore.getRoomId();