Merge pull request #4313 from matrix-org/travis/react-warnings/1-componentDidMount

Use componentDidMount in place of componentWillMount where possible
This commit is contained in:
Travis Ralston 2020-04-01 11:13:04 -06:00 committed by GitHub
commit 59a99bbad8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 81 additions and 91 deletions

View file

@ -38,7 +38,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
// XXX: temporary logging to try to diagnose // XXX: temporary logging to try to diagnose
// https://github.com/vector-im/riot-web/issues/3148 // https://github.com/vector-im/riot-web/issues/3148

View file

@ -37,7 +37,7 @@ export default createReactClass({
return { device: null }; return { device: null };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();

View file

@ -82,7 +82,7 @@ export default class ManageEventIndexDialog extends React.Component {
} }
} }
async componentWillMount(): void { async componentDidMount(): void {
let eventIndexSize = 0; let eventIndexSize = 0;
let crawlingRoomsCount = 0; let crawlingRoomsCount = 0;
let roomCount = 0; let roomCount = 0;

View file

@ -30,7 +30,7 @@ class CustomRoomTagPanel extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
this._tagStoreToken = CustomRoomTagStore.addListener(() => { this._tagStoreToken = CustomRoomTagStore.addListener(() => {
this.setState({tags: CustomRoomTagStore.getSortedTags()}); this.setState({tags: CustomRoomTagStore.getSortedTags()});
}); });

View file

@ -58,7 +58,7 @@ export default class EmbeddedPage extends React.PureComponent {
return sanitizeHtml(_t(s)); return sanitizeHtml(_t(s));
} }
componentWillMount() { componentDidMount() {
this._unmounted = false; this._unmounted = false;
if (!this.props.url) { if (!this.props.url) {

View file

@ -428,7 +428,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
this._matrixClient = MatrixClientPeg.get(); this._matrixClient = MatrixClientPeg.get();
this._matrixClient.on("Group.myMembership", this._onGroupMyMembership); this._matrixClient.on("Group.myMembership", this._onGroupMyMembership);

View file

@ -44,7 +44,7 @@ const LeftPanel = createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this.focusedElement = null; this.focusedElement = null;
this._breadcrumbsWatcherRef = SettingsStore.watchSetting( this._breadcrumbsWatcherRef = SettingsStore.watchSetting(

View file

@ -221,7 +221,8 @@ export default createReactClass({
return {serverConfig: props}; return {serverConfig: props};
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
SdkConfig.put(this.props.config); SdkConfig.put(this.props.config);
// Used by _viewRoom before getting state from sync // Used by _viewRoom before getting state from sync
@ -261,9 +262,7 @@ export default createReactClass({
this._accountPassword = null; this._accountPassword = null;
this._accountPasswordTimer = null; this._accountPasswordTimer = null;
},
componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = dis.register(this.onAction);
this._themeWatcher = new ThemeWatcher(); this._themeWatcher = new ThemeWatcher();
this._themeWatcher.start(); this._themeWatcher.start();

View file

@ -38,7 +38,7 @@ export default createReactClass({
contextType: MatrixClientContext, contextType: MatrixClientContext,
}, },
componentWillMount: function() { componentDidMount: function() {
this._fetch(); this._fetch();
}, },

View file

@ -108,7 +108,7 @@ export default class RightPanel extends React.Component {
} }
} }
componentWillMount() { componentDidMount() {
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = dis.register(this.onAction);
const cli = this.context; const cli = this.context;
cli.on("RoomState.members", this.onRoomStateMember); cli.on("RoomState.members", this.onRoomStateMember);

View file

@ -56,7 +56,8 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
this._unmounted = false; this._unmounted = false;
this.nextBatch = null; this.nextBatch = null;
this.filterTimeout = null; this.filterTimeout = null;
@ -89,9 +90,7 @@ export default createReactClass({
), ),
}); });
}); });
},
componentDidMount: function() {
this.refreshRoomList(); this.refreshRoomList();
}, },

View file

@ -96,7 +96,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
MatrixClientPeg.get().on("sync", this.onSyncStateChange); MatrixClientPeg.get().on("sync", this.onSyncStateChange);
MatrixClientPeg.get().on("Room.localEchoUpdated", this._onRoomLocalEchoUpdated); MatrixClientPeg.get().on("Room.localEchoUpdated", this._onRoomLocalEchoUpdated);

View file

@ -44,7 +44,7 @@ const TagPanel = createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this.unmounted = false; this.unmounted = false;
this.context.on("Group.myMembership", this._onGroupMyMembership); this.context.on("Group.myMembership", this._onGroupMyMembership);
this.context.on("sync", this._onClientSync); this.context.on("sync", this._onClientSync);

View file

@ -35,7 +35,7 @@ export default class UserView extends React.Component {
this.state = {}; this.state = {};
} }
componentWillMount() { componentDidMount() {
if (this.props.userId) { if (this.props.userId) {
this._loadProfileInfo(); this._loadProfileInfo();
} }

View file

@ -69,7 +69,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this.reset = null; this.reset = null;
this._checkServerLiveliness(this.props.serverConfig); this._checkServerLiveliness(this.props.serverConfig);
}, },

View file

@ -113,7 +113,8 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
this._unmounted = false; this._unmounted = false;
// map from login step type to a function which will render a control // map from login step type to a function which will render a control

View file

@ -37,7 +37,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
// There is some assymetry between ChangeDisplayName and ChangeAvatar, // There is some assymetry between ChangeDisplayName and ChangeAvatar,
// as ChangeDisplayName will auto-get the name but ChangeAvatar expects // as ChangeDisplayName will auto-get the name but ChangeAvatar expects
// the URL to be passed to you (because it's also used for room avatars). // the URL to be passed to you (because it's also used for room avatars).

View file

@ -120,7 +120,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
this._replaceClient(); this._replaceClient();
}, },

View file

@ -60,7 +60,7 @@ export default class CountryDropdown extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
if (!this.props.value) { if (!this.props.value) {
// If no value is given, we start with the default // If no value is given, we start with the default
// country selected, but our parent component // country selected, but our parent component

View file

@ -465,7 +465,7 @@ export const MsisdnAuthEntry = createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._submitUrl = null; this._submitUrl = null;
this._sid = null; this._sid = null;
this._msisdn = null; this._msisdn = null;

View file

@ -49,7 +49,7 @@ export default class MemberStatusMessageAvatar extends React.Component {
this._button = createRef(); this._button = createRef();
} }
componentWillMount() { componentDidMount() {
if (this.props.member.userId !== MatrixClientPeg.get().getUserId()) { if (this.props.member.userId !== MatrixClientPeg.get().getUserId()) {
throw new Error("Cannot use MemberStatusMessageAvatar on anyone but the logged in user"); throw new Error("Cannot use MemberStatusMessageAvatar on anyone but the logged in user");
} }

View file

@ -61,7 +61,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
MatrixClientPeg.get().on('RoomMember.powerLevel', this._checkPermissions); MatrixClientPeg.get().on('RoomMember.powerLevel', this._checkPermissions);
this._checkPermissions(); this._checkPermissions();
}, },

View file

@ -82,7 +82,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
}, },

View file

@ -35,7 +35,7 @@ export default class StatusMessageContextMenu extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
const { user } = this.props; const { user } = this.props;
if (!user) { if (!user) {
return; return;

View file

@ -55,7 +55,8 @@ export default createReactClass({
askReason: false, askReason: false,
}), }),
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
this._reasonField = null; this._reasonField = null;
}, },

View file

@ -36,7 +36,7 @@ export default class RoomSettingsDialog extends React.Component {
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,
}; };
componentWillMount() { componentDidMount() {
this._dispatcherRef = dis.register(this._onAction); this._dispatcherRef = dis.register(this._onAction);
} }

View file

@ -30,7 +30,7 @@ export default createReactClass({
onFinished: PropTypes.func.isRequired, onFinished: PropTypes.func.isRequired,
}, },
componentWillMount: async function() { componentDidMount: async function() {
const recommended = await this.props.room.getRecommendedVersion(); const recommended = await this.props.room.getRecommendedVersion();
this._targetVersion = recommended.version; this._targetVersion = recommended.version;
this.setState({busy: false}); this.setState({busy: false});

View file

@ -75,8 +75,8 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
console.info('SetPasswordDialog component will mount'); console.info('SetPasswordDialog component did mount');
}, },
_onPasswordChanged: function(res) { _onPasswordChanged: function(res) {

View file

@ -121,7 +121,7 @@ export default class ShareDialog extends React.Component {
}); });
} }
componentWillMount() { componentDidMount() {
if (this.props.target instanceof Room) { if (this.props.target instanceof Room) {
const permalinkCreator = new RoomPermalinkCreator(this.props.target); const permalinkCreator = new RoomPermalinkCreator(this.props.target);
permalinkCreator.load(); permalinkCreator.load();

View file

@ -87,7 +87,7 @@ export default createReactClass({
onSend: PropTypes.func.isRequired, onSend: PropTypes.func.isRequired,
}, },
componentWillMount: function() { componentDidMount: function() {
MatrixClientPeg.get().on("deviceVerificationChanged", this._onDeviceVerificationChanged); MatrixClientPeg.get().on("deviceVerificationChanged", this._onDeviceVerificationChanged);
}, },

View file

@ -166,14 +166,12 @@ export default class AppTile extends React.Component {
return false; return false;
} }
componentWillMount() { componentDidMount() {
// Only fetch IM token on mount if we're showing and have permission to load // Only fetch IM token on mount if we're showing and have permission to load
if (this.props.show && this.state.hasPermissionToLoad) { if (this.props.show && this.state.hasPermissionToLoad) {
this.setScalarToken(); this.setScalarToken();
} }
}
componentDidMount() {
// Widget action listeners // Widget action listeners
this.dispatcherRef = dis.register(this._onAction); this.dispatcherRef = dis.register(this._onAction);
} }

View file

@ -38,7 +38,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
cli.on("deviceVerificationChanged", this.onDeviceVerificationChanged); cli.on("deviceVerificationChanged", this.onDeviceVerificationChanged);
}, },

View file

@ -42,7 +42,7 @@ export default class EditableTextContainer extends React.Component {
this._onValueChanged = this._onValueChanged.bind(this); this._onValueChanged = this._onValueChanged.bind(this);
} }
componentWillMount() { componentDidMount() {
if (this.props.getInitialValue === undefined) { if (this.props.getInitialValue === undefined) {
// use whatever was given in the initialValue property. // use whatever was given in the initialValue property.
return; return;

View file

@ -40,7 +40,7 @@ export default class LanguageDropdown extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
languageHandler.getAllLanguagesFromJson().then((langs) => { languageHandler.getAllLanguagesFromJson().then((langs) => {
langs.sort(function(a, b) { langs.sort(function(a, b) {
if (a.label < b.label) return -1; if (a.label < b.label) return -1;

View file

@ -33,7 +33,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate); this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
ActiveWidgetStore.on('update', this._onActiveWidgetStoreUpdate); ActiveWidgetStore.on('update', this._onActiveWidgetStoreUpdate);
}, },

View file

@ -155,7 +155,7 @@ const Pill = createReactClass({
this.setState({resourceId, pillType, member, group, room}); this.setState({resourceId, pillType, member, group, room});
}, },
componentWillMount() { componentDidMount() {
this._unmounted = false; this._unmounted = false;
this._matrixClient = MatrixClientPeg.get(); this._matrixClient = MatrixClientPeg.get();
this.componentWillReceiveProps(this.props); this.componentWillReceiveProps(this.props);

View file

@ -62,7 +62,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._initStateFromProps(this.props); this._initStateFromProps(this.props);
}, },

View file

@ -184,7 +184,7 @@ export default class ReplyThread extends React.Component {
ref={ref} permalinkCreator={permalinkCreator} />; ref={ref} permalinkCreator={permalinkCreator} />;
} }
componentWillMount() { componentDidMount() {
this.unmounted = false; this.unmounted = false;
this.room = this.context.getRoom(this.props.parentEv.getRoomId()); this.room = this.context.getRoom(this.props.parentEv.getRoomId());
this.room.on("Room.redaction", this.onRoomRedaction); this.room.on("Room.redaction", this.onRoomRedaction);

View file

@ -36,11 +36,9 @@ const TintableSvg = createReactClass({
idSequence: 0, idSequence: 0,
}, },
componentWillMount: function() {
this.fixups = [];
},
componentDidMount: function() { componentDidMount: function() {
this.fixups = [];
this.id = TintableSvg.idSequence++; this.id = TintableSvg.idSequence++;
TintableSvg.mounts[this.id] = this; TintableSvg.mounts[this.id] = this;
}, },

View file

@ -49,7 +49,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
this._initGroupStore(this.props.groupId); this._initGroupStore(this.props.groupId);
}, },

View file

@ -47,7 +47,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
this._initGroupStore(this.props.groupId); this._initGroupStore(this.props.groupId);
}, },

View file

@ -36,7 +36,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._initGroupStore(this.props.groupId); this._initGroupStore(this.props.groupId);
}, },

View file

@ -47,7 +47,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._initGroupStore(this.props.groupId); this._initGroupStore(this.props.groupId);
}, },

View file

@ -39,7 +39,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._unmounted = false; this._unmounted = false;
this._initGroupStore(this.props.groupId); this._initGroupStore(this.props.groupId);
}, },

View file

@ -55,7 +55,7 @@ const GroupTile = createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
FlairStore.getGroupProfileCached(this.context, this.props.groupId).then((profile) => { FlairStore.getGroupProfileCached(this.context, this.props.groupId).then((profile) => {
this.setState({profile}); this.setState({profile});
}).catch((err) => { }).catch((err) => {

View file

@ -34,7 +34,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this.context.getJoinedGroups().then((result) => { this.context.getJoinedGroups().then((result) => {
this.setState({groups: result.groups || [], error: null}); this.setState({groups: result.groups || [], error: null});
}, (err) => { }, (err) => {

View file

@ -67,11 +67,6 @@ export default class MImageBody extends React.Component {
this._image = createRef(); this._image = createRef();
} }
componentWillMount() {
this.unmounted = false;
this.context.on('sync', this.onClientSync);
}
// FIXME: factor this out and aplpy it to MVideoBody and MAudioBody too! // FIXME: factor this out and aplpy it to MVideoBody and MAudioBody too!
onClientSync(syncState, prevState) { onClientSync(syncState, prevState) {
if (this.unmounted) return; if (this.unmounted) return;
@ -258,6 +253,9 @@ export default class MImageBody extends React.Component {
} }
componentDidMount() { componentDidMount() {
this.unmounted = false;
this.context.on('sync', this.onClientSync);
const content = this.props.mxEvent.getContent(); const content = this.props.mxEvent.getContent();
if (content.file !== undefined && this.state.decryptedUrl === null) { if (content.file !== undefined && this.state.decryptedUrl === null) {
let thumbnailPromise = Promise.resolve(null); let thumbnailPromise = Promise.resolve(null);

View file

@ -42,7 +42,7 @@ export default createReactClass({
}; };
}, },
componentWillMount() { componentDidMount() {
this.unmounted = false; this.unmounted = false;
this._updateRelatedGroups(); this._updateRelatedGroups();

View file

@ -40,7 +40,7 @@ export default class HeaderButtons extends React.Component {
}; };
} }
componentWillMount() { componentDidMount() {
this._storeToken = RightPanelStore.getSharedInstance().addListener(this.onRightPanelUpdate.bind(this)); this._storeToken = RightPanelStore.getSharedInstance().addListener(this.onRightPanelUpdate.bind(this));
this._dispatcherRef = dis.register(this.onAction.bind(this)); // used by subclasses this._dispatcherRef = dis.register(this.onAction.bind(this)); // used by subclasses
} }

View file

@ -55,13 +55,10 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
ScalarMessaging.startListening(); ScalarMessaging.startListening();
MatrixClientPeg.get().on('RoomState.events', this.onRoomStateEvents); MatrixClientPeg.get().on('RoomState.events', this.onRoomStateEvents);
WidgetEchoStore.on('update', this._updateApps); WidgetEchoStore.on('update', this._updateApps);
},
componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction); this.dispatcherRef = dis.register(this.onAction);
}, },

View file

@ -223,7 +223,7 @@ export default class EditMessageComposer extends React.Component {
this.props.editState.setEditorState(caret, parts); this.props.editState.setEditorState(caret, parts);
} }
componentWillMount() { componentDidMount() {
this._createEditorModel(); this._createEditorModel();
} }

View file

@ -30,14 +30,12 @@ export default createReactClass({
onCancelClick: PropTypes.func.isRequired, onCancelClick: PropTypes.func.isRequired,
}, },
componentWillMount: function() { componentDidMount: function() {
dis.dispatch({ dis.dispatch({
action: 'panel_disable', action: 'panel_disable',
middleDisabled: true, middleDisabled: true,
}); });
},
componentDidMount: function() {
document.addEventListener('keydown', this._onKeyDown); document.addEventListener('keydown', this._onKeyDown);
}, },

View file

@ -79,7 +79,8 @@ export default createReactClass({
contextType: MatrixClientContext, contextType: MatrixClientContext,
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
this._cancelDeviceList = null; this._cancelDeviceList = null;
const cli = this.context; const cli = this.context;
@ -98,9 +99,7 @@ export default createReactClass({
cli.on("accountData", this.onAccountData); cli.on("accountData", this.onAccountData);
this._checkIgnoreState(); this._checkIgnoreState();
},
componentDidMount: function() {
this._updateStateForNewMember(this.props.member); this._updateStateForNewMember(this.props.member);
}, },

View file

@ -49,7 +49,8 @@ export default createReactClass({
} }
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
this._mounted = true; this._mounted = true;
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
if (cli.hasLazyLoadMembersEnabled()) { if (cli.hasLazyLoadMembersEnabled()) {

View file

@ -49,7 +49,7 @@ export default class RoomBreadcrumbs extends React.Component {
this._scroller = createRef(); this._scroller = createRef();
} }
componentWillMount() { componentDidMount() {
this._dispatcherRef = dis.register(this.onAction); this._dispatcherRef = dis.register(this.onAction);
const storedRooms = SettingsStore.getValue("breadcrumb_rooms"); const storedRooms = SettingsStore.getValue("breadcrumb_rooms");

View file

@ -34,7 +34,8 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { // TODO: [REACT-WARNING] Move this to constructor
UNSAFE_componentWillMount: function() {
const room = this.props.room; const room = this.props.room;
const name = room.currentState.getStateEvents('m.room.name', ''); const name = room.currentState.getStateEvents('m.room.name', '');
const myId = MatrixClientPeg.get().credentials.userId; const myId = MatrixClientPeg.get().credentials.userId;

View file

@ -97,7 +97,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._checkInvitedEmail(); this._checkInvitedEmail();
}, },

View file

@ -44,7 +44,7 @@ export default class RoomRecoveryReminder extends React.PureComponent {
}; };
} }
componentWillMount() { componentDidMount() {
this._loadBackupStatus(); this._loadBackupStatus();
} }

View file

@ -33,7 +33,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
const room = this.props.room; const room = this.props.room;
const topic = room.currentState.getStateEvents('m.room.topic', ''); const topic = room.currentState.getStateEvents('m.room.topic', '');
this.setState({ this.setState({

View file

@ -31,7 +31,7 @@ export default createReactClass({
recommendation: PropTypes.object.isRequired, recommendation: PropTypes.object.isRequired,
}, },
componentWillMount: function() { componentDidMount: function() {
const tombstone = this.props.room.currentState.getStateEvents("m.room.tombstone", ""); const tombstone = this.props.room.currentState.getStateEvents("m.room.tombstone", "");
this.setState({upgraded: tombstone && tombstone.getContent().replacement_room}); this.setState({upgraded: tombstone && tombstone.getContent().replacement_room});

View file

@ -51,7 +51,7 @@ export default class ThirdPartyMemberInfo extends React.Component {
}; };
} }
componentWillMount(): void { componentDidMount(): void {
MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents); MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents);
} }

View file

@ -54,7 +54,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
MatrixClientPeg.get().on("RoomMember.typing", this.onRoomMemberTyping); MatrixClientPeg.get().on("RoomMember.typing", this.onRoomMemberTyping);
MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline); MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline);
}, },

View file

@ -55,7 +55,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents); MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents);
}, },

View file

@ -78,7 +78,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._sessionStore = sessionStore; this._sessionStore = sessionStore;
this._sessionStoreToken = this._sessionStore.addListener( this._sessionStoreToken = this._sessionStore.addListener(
this._setStateFromSessionStore, this._setStateFromSessionStore,

View file

@ -63,7 +63,7 @@ export default class EventIndexPanel extends React.Component {
} }
} }
async componentWillMount(): void { async componentDidMount(): void {
this.updateState(); this.updateState();
} }

View file

@ -38,7 +38,7 @@ export default class KeyBackupPanel extends React.PureComponent {
}; };
} }
componentWillMount() { componentDidMount() {
this._checkKeyBackupStatus(); this._checkKeyBackupStatus();
MatrixClientPeg.get().on('crypto.keyBackupStatus', this._onKeyBackupStatus); MatrixClientPeg.get().on('crypto.keyBackupStatus', this._onKeyBackupStatus);

View file

@ -87,7 +87,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._refreshFromServer(); this._refreshFromServer();
}, },

View file

@ -40,7 +40,7 @@ export default class HelpUserSettingsTab extends React.Component {
}; };
} }
componentWillMount(): void { componentDidMount(): void {
PlatformPeg.get().getAppVersion().then((ver) => this.setState({vectorVersion: ver})).catch((e) => { PlatformPeg.get().getAppVersion().then((ver) => this.setState({vectorVersion: ver})).catch((e) => {
console.error("Error getting vector version: ", e); console.error("Error getting vector version: ", e);
}); });

View file

@ -81,7 +81,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
}; };
} }
async componentWillMount(): void { async componentDidMount(): void {
const platform = PlatformPeg.get(); const platform = PlatformPeg.get();
const autoLaunchSupported = await platform.supportsAutoLaunch(); const autoLaunchSupported = await platform.supportsAutoLaunch();

View file

@ -40,7 +40,7 @@ export default createReactClass({
}; };
}, },
componentWillMount: function() { componentDidMount: function() {
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate); this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
this.dispatcherRef = dis.register(this._onAction); this.dispatcherRef = dis.register(this._onAction);
}, },