You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
avoid updating the memberlist while the spinner is shown
the memberlist gets updated constantly while the LL members are being added to the room state. this slows things down unneed, and is one of the main cause of dropping frames when member arrive.
This commit is contained in:
@@ -33,6 +33,7 @@ module.exports = React.createClass({
|
|||||||
|
|
||||||
getInitialState: function() {
|
getInitialState: function() {
|
||||||
this.memberDict = this.getMemberDict();
|
this.memberDict = this.getMemberDict();
|
||||||
|
this._mounted = false;
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli.hasLazyLoadMembersEnabled()) {
|
if (cli.hasLazyLoadMembersEnabled()) {
|
||||||
@@ -43,6 +44,19 @@ module.exports = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
if (!cli.hasLazyLoadMembersEnabled()) {
|
||||||
|
this._listenForMembersChanges();
|
||||||
|
}
|
||||||
|
const enablePresenceByHsUrl = SdkConfig.get()["enable_presence_by_hs_url"];
|
||||||
|
const hsUrl = MatrixClientPeg.get().baseUrl;
|
||||||
|
this._showPresence = true;
|
||||||
|
if (enablePresenceByHsUrl && enablePresenceByHsUrl[hsUrl] !== undefined) {
|
||||||
|
this._showPresence = enablePresenceByHsUrl[hsUrl];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_listenForMembersChanges: function() {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
cli.on("RoomState.members", this.onRoomStateMember);
|
cli.on("RoomState.members", this.onRoomStateMember);
|
||||||
cli.on("RoomMember.name", this.onRoomMemberName);
|
cli.on("RoomMember.name", this.onRoomMemberName);
|
||||||
@@ -53,25 +67,22 @@ module.exports = React.createClass({
|
|||||||
// the information contained in presence events).
|
// the information contained in presence events).
|
||||||
cli.on("User.lastPresenceTs", this.onUserLastPresenceTs);
|
cli.on("User.lastPresenceTs", this.onUserLastPresenceTs);
|
||||||
// cli.on("Room.timeline", this.onRoomTimeline);
|
// cli.on("Room.timeline", this.onRoomTimeline);
|
||||||
|
|
||||||
const enablePresenceByHsUrl = SdkConfig.get()["enable_presence_by_hs_url"];
|
|
||||||
const hsUrl = MatrixClientPeg.get().baseUrl;
|
|
||||||
|
|
||||||
this._showPresence = true;
|
|
||||||
if (enablePresenceByHsUrl && enablePresenceByHsUrl[hsUrl] !== undefined) {
|
|
||||||
this._showPresence = enablePresenceByHsUrl[hsUrl];
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: async function() {
|
componentDidMount: async function() {
|
||||||
|
this._mounted = true;
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli.hasLazyLoadMembersEnabled()) {
|
if (cli.hasLazyLoadMembersEnabled()) {
|
||||||
await this._waitForMembersToLoad();
|
await this._waitForMembersToLoad();
|
||||||
|
if (this._mounted) {
|
||||||
this.setState(this._getMembersState());
|
this.setState(this._getMembersState());
|
||||||
|
this._listenForMembersChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount: function() {
|
||||||
|
this._mounted = false;
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
if (cli) {
|
if (cli) {
|
||||||
cli.removeListener("RoomState.members", this.onRoomStateMember);
|
cli.removeListener("RoomState.members", this.onRoomStateMember);
|
||||||
|
|||||||
Reference in New Issue
Block a user