You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-18 09:22:18 +03:00
Introduce state peekLoading
to avoid collision with roomLoading
The room loading spinner will now be displayed if the alias is being resolved (roomLoading) or if the peek is being loaded for the room `peekLoading`.
This commit is contained in:
@ -120,6 +120,7 @@ module.exports = React.createClass({
|
|||||||
room: null,
|
room: null,
|
||||||
roomId: null,
|
roomId: null,
|
||||||
roomLoading: true,
|
roomLoading: true,
|
||||||
|
peekLoading: false,
|
||||||
|
|
||||||
forwardingEvent: null,
|
forwardingEvent: null,
|
||||||
editingRoomSettings: false,
|
editingRoomSettings: false,
|
||||||
@ -222,10 +223,13 @@ module.exports = React.createClass({
|
|||||||
} else if (this.state.roomId) {
|
} else if (this.state.roomId) {
|
||||||
console.log("Attempting to peek into room %s", 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) => {
|
MatrixClientPeg.get().peekInRoom(this.state.roomId).then((room) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
room: room,
|
room: room,
|
||||||
roomLoading: false,
|
peekLoading: false,
|
||||||
});
|
});
|
||||||
this._onRoomLoaded(room);
|
this._onRoomLoaded(room);
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
@ -235,7 +239,7 @@ module.exports = React.createClass({
|
|||||||
if (err.errcode == "M_GUEST_ACCESS_FORBIDDEN") {
|
if (err.errcode == "M_GUEST_ACCESS_FORBIDDEN") {
|
||||||
// This is fine: the room just isn't peekable (we assume).
|
// This is fine: the room just isn't peekable (we assume).
|
||||||
this.setState({
|
this.setState({
|
||||||
roomLoading: false,
|
peekLoading: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw err;
|
throw err;
|
||||||
@ -1422,7 +1426,7 @@ module.exports = React.createClass({
|
|||||||
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
const TimelinePanel = sdk.getComponent("structures.TimelinePanel");
|
||||||
|
|
||||||
if (!this.state.room) {
|
if (!this.state.room) {
|
||||||
if (this.state.roomLoading) {
|
if (this.state.roomLoading || this.state.peekLoading) {
|
||||||
return (
|
return (
|
||||||
<div className="mx_RoomView">
|
<div className="mx_RoomView">
|
||||||
<Loader />
|
<Loader />
|
||||||
|
@ -41,7 +41,6 @@ class LifecycleStore extends Store {
|
|||||||
__onDispatch(payload) {
|
__onDispatch(payload) {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case 'do_after_sync_prepared':
|
case 'do_after_sync_prepared':
|
||||||
console.info('Will do after sync', payload.deferred_action);
|
|
||||||
this._setState({
|
this._setState({
|
||||||
deferred_action: payload.deferred_action,
|
deferred_action: payload.deferred_action,
|
||||||
});
|
});
|
||||||
@ -50,7 +49,6 @@ class LifecycleStore extends Store {
|
|||||||
if (payload.state !== 'PREPARED') {
|
if (payload.state !== 'PREPARED') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.info('Doing', payload.deferred_action);
|
|
||||||
if (!this._state.deferred_action) break;
|
if (!this._state.deferred_action) break;
|
||||||
const deferredAction = Object.assign({}, this._state.deferred_action);
|
const deferredAction = Object.assign({}, this._state.deferred_action);
|
||||||
this._setState({
|
this._setState({
|
||||||
|
Reference in New Issue
Block a user