Merge pull request #5546 from matrix-org/jryans/react-warnings
Fix some misc. React warnings when viewing timeline
This commit is contained in:
commit
48a3154ab6
2 changed files with 24 additions and 15 deletions
|
@ -140,7 +140,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
protected readonly _matrixClient: MatrixClient;
|
protected readonly _matrixClient: MatrixClient;
|
||||||
protected readonly _roomView: React.RefObject<any>;
|
protected readonly _roomView: React.RefObject<any>;
|
||||||
protected readonly _resizeContainer: React.RefObject<ResizeHandle>;
|
protected readonly _resizeContainer: React.RefObject<ResizeHandle>;
|
||||||
protected readonly _compactLayoutWatcherRef: string;
|
protected compactLayoutWatcherRef: string;
|
||||||
protected resizer: Resizer;
|
protected resizer: Resizer;
|
||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
|
@ -157,18 +157,6 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
CallMediaHandler.loadDevices();
|
CallMediaHandler.loadDevices();
|
||||||
|
|
||||||
document.addEventListener('keydown', this._onNativeKeyDown, false);
|
|
||||||
|
|
||||||
this._updateServerNoticeEvents();
|
|
||||||
|
|
||||||
this._matrixClient.on("accountData", this.onAccountData);
|
|
||||||
this._matrixClient.on("sync", this.onSync);
|
|
||||||
this._matrixClient.on("RoomState.events", this.onRoomStateEvents);
|
|
||||||
|
|
||||||
this._compactLayoutWatcherRef = SettingsStore.watchSetting(
|
|
||||||
"useCompactLayout", null, this.onCompactLayoutChanged,
|
|
||||||
);
|
|
||||||
|
|
||||||
fixupColorFonts();
|
fixupColorFonts();
|
||||||
|
|
||||||
this._roomView = React.createRef();
|
this._roomView = React.createRef();
|
||||||
|
@ -176,6 +164,24 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
document.addEventListener('keydown', this._onNativeKeyDown, false);
|
||||||
|
|
||||||
|
this._updateServerNoticeEvents();
|
||||||
|
|
||||||
|
this._matrixClient.on("accountData", this.onAccountData);
|
||||||
|
this._matrixClient.on("sync", this.onSync);
|
||||||
|
// Call `onSync` with the current state as well
|
||||||
|
this.onSync(
|
||||||
|
this._matrixClient.getSyncState(),
|
||||||
|
null,
|
||||||
|
this._matrixClient.getSyncStateData(),
|
||||||
|
);
|
||||||
|
this._matrixClient.on("RoomState.events", this.onRoomStateEvents);
|
||||||
|
|
||||||
|
this.compactLayoutWatcherRef = SettingsStore.watchSetting(
|
||||||
|
"useCompactLayout", null, this.onCompactLayoutChanged,
|
||||||
|
);
|
||||||
|
|
||||||
this.resizer = this._createResizer();
|
this.resizer = this._createResizer();
|
||||||
this.resizer.attach();
|
this.resizer.attach();
|
||||||
this._loadResizerPreferences();
|
this._loadResizerPreferences();
|
||||||
|
@ -186,7 +192,7 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
this._matrixClient.removeListener("accountData", this.onAccountData);
|
this._matrixClient.removeListener("accountData", this.onAccountData);
|
||||||
this._matrixClient.removeListener("sync", this.onSync);
|
this._matrixClient.removeListener("sync", this.onSync);
|
||||||
this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
|
this._matrixClient.removeListener("RoomState.events", this.onRoomStateEvents);
|
||||||
SettingsStore.unwatchSetting(this._compactLayoutWatcherRef);
|
SettingsStore.unwatchSetting(this.compactLayoutWatcherRef);
|
||||||
this.resizer.detach();
|
this.resizer.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,10 @@ export default class TextualBody extends React.Component {
|
||||||
ref: this._content,
|
ref: this._content,
|
||||||
});
|
});
|
||||||
if (this.props.replacingEventId) {
|
if (this.props.replacingEventId) {
|
||||||
body = [body, this._renderEditedMarker()];
|
body = <>
|
||||||
|
{body}
|
||||||
|
{this._renderEditedMarker()}
|
||||||
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.highlightLink) {
|
if (this.props.highlightLink) {
|
||||||
|
|
Loading…
Reference in a new issue