fix room.observer problem
This commit is contained in:
parent
11c347e222
commit
8192b391ea
|
@ -303,7 +303,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
};
|
};
|
||||||
this.setHeader();
|
this.setHeader();
|
||||||
|
|
||||||
if (room && room.observe) {
|
if (room && room.observe()) {
|
||||||
this.observeRoom(room);
|
this.observeRoom(room);
|
||||||
} else if (this.rid) {
|
} else if (this.rid) {
|
||||||
this.findAndObserveRoom(this.rid);
|
this.findAndObserveRoom(this.rid);
|
||||||
|
@ -702,11 +702,11 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
delete this.sub;
|
delete this.sub;
|
||||||
};
|
};
|
||||||
|
|
||||||
observeRoom = (room: IRoom) => {
|
observeRoom = (room: TRoomModel) => {
|
||||||
if (room.observe) {
|
if (room.observe) {
|
||||||
const observable = room.observe();
|
const observable = room.observe();
|
||||||
this.subSubscription = observable.subscribe((changes: any) => {
|
this.subSubscription = observable.subscribe(changes => {
|
||||||
const roomUpdate = roomAttrsUpdate.reduce((ret: any, attr: any) => {
|
const roomUpdate = roomAttrsUpdate.reduce((ret: any, attr) => {
|
||||||
ret[attr] = changes[attr];
|
ret[attr] = changes[attr];
|
||||||
return ret;
|
return ret;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
Loading…
Reference in New Issue