Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Introduce state peekLoading to avoid collision with roomLoading #1028

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/structures/RoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module.exports = React.createClass({
room: null,
roomId: null,
roomLoading: true,
peekLoading: false,

forwardingEvent: null,
editingRoomSettings: false,
Expand Down Expand Up @@ -222,10 +223,13 @@ module.exports = React.createClass({
} else if (this.state.roomId) {
console.log("Attempting to peek into room %s", this.state.roomId);

this.setState({
peekLoading: true,
});
MatrixClientPeg.get().peekInRoom(this.state.roomId).then((room) => {
this.setState({
room: room,
roomLoading: false,
peekLoading: false,
});
this._onRoomLoaded(room);
}, (err) => {
Expand All @@ -235,7 +239,7 @@ module.exports = React.createClass({
if (err.errcode == "M_GUEST_ACCESS_FORBIDDEN") {
// This is fine: the room just isn't peekable (we assume).
this.setState({
roomLoading: false,
peekLoading: false,
});
} else {
throw err;
Expand Down Expand Up @@ -1422,7 +1426,7 @@ module.exports = React.createClass({
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");

if (!this.state.room) {
if (this.state.roomLoading) {
if (this.state.roomLoading || this.state.peekLoading) {
return (
<div className="mx_RoomView">
<Loader />
Expand Down
2 changes: 0 additions & 2 deletions src/stores/LifecycleStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class LifecycleStore extends Store {
__onDispatch(payload) {
switch (payload.action) {
case 'do_after_sync_prepared':
console.info('Will do after sync', payload.deferred_action);
this._setState({
deferred_action: payload.deferred_action,
});
Expand All @@ -50,7 +49,6 @@ class LifecycleStore extends Store {
if (payload.state !== 'PREPARED') {
break;
}
console.info('Doing', payload.deferred_action);
if (!this._state.deferred_action) break;
const deferredAction = Object.assign({}, this._state.deferred_action);
this._setState({
Expand Down