Silence usages of componentWillReceiveProps
For https://github.com/vector-im/riot-web/issues/12877
This commit is contained in:
parent
ab6bd4104f
commit
47e5cfecf2
28 changed files with 56 additions and 30 deletions
|
@ -450,8 +450,9 @@ export default createReactClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
if (this.props.groupId != newProps.groupId) {
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
|
if (this.props.groupId !== newProps.groupId) {
|
||||||
this.setState({
|
this.setState({
|
||||||
summary: null,
|
summary: null,
|
||||||
error: null,
|
error: null,
|
||||||
|
|
|
@ -123,7 +123,8 @@ export default class RightPanel extends React.Component {
|
||||||
this._unregisterGroupStore(this.props.groupId);
|
this._unregisterGroupStore(this.props.groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.groupId !== this.props.groupId) {
|
if (newProps.groupId !== this.props.groupId) {
|
||||||
this._unregisterGroupStore(this.props.groupId);
|
this._unregisterGroupStore(this.props.groupId);
|
||||||
this._initGroupStore(newProps.groupId);
|
this._initGroupStore(newProps.groupId);
|
||||||
|
|
|
@ -235,7 +235,8 @@ const TimelinePanel = createReactClass({
|
||||||
this._initTimeline(this.props);
|
this._initTimeline(this.props);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
if (newProps.timelineSet !== this.props.timelineSet) {
|
if (newProps.timelineSet !== this.props.timelineSet) {
|
||||||
// throw new Error("changing timelineSet on a TimelinePanel is not supported");
|
// throw new Error("changing timelineSet on a TimelinePanel is not supported");
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,8 @@ export default createReactClass({
|
||||||
this._checkServerLiveliness(this.props.serverConfig);
|
this._checkServerLiveliness(this.props.serverConfig);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
||||||
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,8 @@ export default createReactClass({
|
||||||
this._unmounted = true;
|
this._unmounted = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
||||||
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,8 @@ export default createReactClass({
|
||||||
this._replaceClient();
|
this._replaceClient();
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
if (newProps.serverConfig.hsUrl === this.props.serverConfig.hsUrl &&
|
||||||
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
newProps.serverConfig.isUrl === this.props.serverConfig.isUrl) return;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ export default class ServerConfig extends React.PureComponent {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.serverConfig.hsUrl === this.state.hsUrl &&
|
if (newProps.serverConfig.hsUrl === this.state.hsUrl &&
|
||||||
newProps.serverConfig.isUrl === this.state.isUrl) return;
|
newProps.serverConfig.isUrl === this.state.isUrl) return;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,8 @@ export default createReactClass({
|
||||||
this.context.removeListener('sync', this.onClientSync);
|
this.context.removeListener('sync', this.onClientSync);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(nextProps) {
|
||||||
// work out if we need to call setState (if the image URLs array has changed)
|
// work out if we need to call setState (if the image URLs array has changed)
|
||||||
const newState = this._getState(nextProps);
|
const newState = this._getState(nextProps);
|
||||||
const newImageUrls = newState.imageUrls;
|
const newImageUrls = newState.imageUrls;
|
||||||
|
|
|
@ -51,7 +51,8 @@ export default createReactClass({
|
||||||
return this._getState(this.props);
|
return this._getState(this.props);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(nextProps) {
|
||||||
this.setState(this._getState(nextProps));
|
this.setState(this._getState(nextProps));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,8 @@ export default createReactClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
this.setState({
|
this.setState({
|
||||||
urls: this.getImageUrls(newProps),
|
urls: this.getImageUrls(newProps),
|
||||||
});
|
});
|
||||||
|
|
|
@ -267,7 +267,8 @@ class FilteredList extends React.PureComponent {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if (this.props.children === nextProps.children && this.props.query === nextProps.query) return;
|
if (this.props.children === nextProps.children && this.props.query === nextProps.query) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
filteredChildren: FilteredList.filterChildren(nextProps.children, nextProps.query),
|
filteredChildren: FilteredList.filterChildren(nextProps.children, nextProps.query),
|
||||||
|
|
|
@ -46,7 +46,8 @@ export default createReactClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(props) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(props) {
|
||||||
// Make sure the selected item isn't outside the list bounds
|
// Make sure the selected item isn't outside the list bounds
|
||||||
const selected = this.state.selected;
|
const selected = this.state.selected;
|
||||||
const maxSelected = this._maxSelected(props.addressList);
|
const maxSelected = this._maxSelected(props.addressList);
|
||||||
|
|
|
@ -262,7 +262,8 @@ export default class AppTile extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.app.url !== this.props.app.url) {
|
if (nextProps.app.url !== this.props.app.url) {
|
||||||
this._getNewState(nextProps);
|
this._getNewState(nextProps);
|
||||||
// Fetch IM token for new URL if we're showing and have permission to load
|
// Fetch IM token for new URL if we're showing and have permission to load
|
||||||
|
|
|
@ -128,7 +128,8 @@ export default class Dropdown extends React.Component {
|
||||||
document.removeEventListener('click', this._onDocumentClick, false);
|
document.removeEventListener('click', this._onDocumentClick, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if (!nextProps.children || nextProps.children.length === 0) {
|
if (!nextProps.children || nextProps.children.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,8 @@ export default createReactClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(nextProps) {
|
||||||
if (nextProps.initialValue !== this.props.initialValue) {
|
if (nextProps.initialValue !== this.props.initialValue) {
|
||||||
this.value = nextProps.initialValue;
|
this.value = nextProps.initialValue;
|
||||||
if (this._editable_div.current) {
|
if (this._editable_div.current) {
|
||||||
|
|
|
@ -81,7 +81,8 @@ export default class Flair extends React.Component {
|
||||||
this._unmounted = true;
|
this._unmounted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
this._generateAvatars(newProps.groups);
|
this._generateAvatars(newProps.groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ const Pill = createReactClass({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
async componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
async UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
let resourceId;
|
let resourceId;
|
||||||
let prefix;
|
let prefix;
|
||||||
|
|
||||||
|
@ -158,7 +159,7 @@ const Pill = createReactClass({
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._unmounted = false;
|
this._unmounted = false;
|
||||||
this._matrixClient = MatrixClientPeg.get();
|
this._matrixClient = MatrixClientPeg.get();
|
||||||
this.componentWillReceiveProps(this.props); // HACK: We shouldn't be calling lifecycle functions ourselves.
|
this.UNSAFE_componentWillReceiveProps(this.props); // HACK: We shouldn't be calling lifecycle functions ourselves.
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
|
|
@ -67,7 +67,8 @@ export default createReactClass({
|
||||||
this._initStateFromProps(this.props);
|
this._initStateFromProps(this.props);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
this._initStateFromProps(newProps);
|
this._initStateFromProps(newProps);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ export default class SyntaxHighlight extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
// componentDidUpdate used here for reusability
|
// componentDidUpdate used here for reusability
|
||||||
// componentWillReceiveProps fires too early to call highlightBlock on.
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this._el) highlightBlock(this._el);
|
if (this._el) highlightBlock(this._el);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ export default createReactClass({
|
||||||
this._initGroupStore(this.props.groupId);
|
this._initGroupStore(this.props.groupId);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.groupId !== this.props.groupId) {
|
if (newProps.groupId !== this.props.groupId) {
|
||||||
this._unregisterGroupStore(this.props.groupId);
|
this._unregisterGroupStore(this.props.groupId);
|
||||||
this._initGroupStore(newProps.groupId);
|
this._initGroupStore(newProps.groupId);
|
||||||
|
|
|
@ -51,7 +51,8 @@ export default createReactClass({
|
||||||
this._initGroupStore(this.props.groupId);
|
this._initGroupStore(this.props.groupId);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
if (newProps.groupId !== this.props.groupId) {
|
if (newProps.groupId !== this.props.groupId) {
|
||||||
this._unregisterGroupStore(this.props.groupId);
|
this._unregisterGroupStore(this.props.groupId);
|
||||||
this._initGroupStore(newProps.groupId);
|
this._initGroupStore(newProps.groupId);
|
||||||
|
|
|
@ -71,7 +71,8 @@ export default createReactClass({
|
||||||
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(newProps) {
|
||||||
// Room has changed probably, update apps
|
// Room has changed probably, update apps
|
||||||
this._updateApps();
|
this._updateApps();
|
||||||
},
|
},
|
||||||
|
|
|
@ -254,7 +254,8 @@ export default createReactClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(nextProps) {
|
||||||
// re-check the sender verification as outgoing events progress through
|
// re-check the sender verification as outgoing events progress through
|
||||||
// the send process.
|
// the send process.
|
||||||
if (nextProps.eventSendStatus !== this.props.eventSendStatus) {
|
if (nextProps.eventSendStatus !== this.props.eventSendStatus) {
|
||||||
|
|
|
@ -103,7 +103,8 @@ export default createReactClass({
|
||||||
this._updateStateForNewMember(this.props.member);
|
this._updateStateForNewMember(this.props.member);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
if (this.props.member.userId !== newProps.member.userId) {
|
if (this.props.member.userId !== newProps.member.userId) {
|
||||||
this._updateStateForNewMember(newProps.member);
|
this._updateStateForNewMember(newProps.member);
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,8 @@ export default createReactClass({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(props) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(props) {
|
||||||
// XXX: This could be a lot better - this makes the assumption that
|
// XXX: This could be a lot better - this makes the assumption that
|
||||||
// the notification count may have changed when the properties of
|
// the notification count may have changed when the properties of
|
||||||
// the room tile change.
|
// the room tile change.
|
||||||
|
|
|
@ -59,7 +59,8 @@ export default createReactClass({
|
||||||
MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents);
|
MatrixClientPeg.get().on("RoomState.events", this.onRoomStateEvents);
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillReceiveProps: function(newProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps: function(newProps) {
|
||||||
if (this.avatarSet) {
|
if (this.avatarSet) {
|
||||||
// don't clobber what the user has just set
|
// don't clobber what the user has just set
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -58,7 +58,8 @@ export class EmailAddress extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
const { bound } = nextProps.email;
|
const { bound } = nextProps.email;
|
||||||
this.setState({ bound });
|
this.setState({ bound });
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,8 @@ export class PhoneNumber extends React.Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
// TODO: [REACT-WARNING] Replace with appropriate lifecycle event
|
||||||
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
const { bound } = nextProps.msisdn;
|
const { bound } = nextProps.msisdn;
|
||||||
this.setState({ bound });
|
this.setState({ bound });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue