Edit pages: remove UNSAFE componentsWillReceiveProps.

master
Tom Hacohen 4 years ago
parent e38181a8ae
commit 0fc92b46a7

@ -157,6 +157,7 @@ const CollectionRoutes = withStyles(styles)(withRouter(
render={() => (
<Container style={{ maxWidth: '30rem' }}>
<ComponentEdit
key={props.routePrefix}
collections={props.collections}
onSave={props.onItemSave}
onCancel={props.onItemCancel}
@ -177,6 +178,7 @@ const CollectionRoutes = withStyles(styles)(withRouter(
<Container style={{ maxWidth: '30rem' }}>
{(itemUid in props.items) &&
<ComponentEdit
key={(props.items[itemUid] as any).journalUid}
initialCollection={(props.items[itemUid] as any).journalUid}
item={props.items[itemUid]}
collections={props.collections}
@ -203,6 +205,7 @@ const CollectionRoutes = withStyles(styles)(withRouter(
<Container style={{ maxWidth: '30rem' }}>
{(itemUid in props.items) &&
<ComponentEdit
key={(props.items[itemUid] as any).journalUid}
initialCollection={(props.items[itemUid] as any).journalUid}
item={props.items[itemUid]}
collections={props.collections}

@ -240,21 +240,6 @@ class ContactEdit extends React.PureComponent<PropsType> {
this.onDeleteRequest = this.onDeleteRequest.bind(this);
}
public UNSAFE_componentWillReceiveProps(nextProps: any) {
if ((this.props.collections !== nextProps.collections) ||
(this.props.initialCollection !== nextProps.initialCollection)) {
if (nextProps.initialCollection) {
this.setState({
journalUid: nextProps.initialCollection,
});
} else if (nextProps.collections[0]) {
this.setState({
journalUid: nextProps.collections[0].uid,
});
}
}
}
public addValueType(name: string, _type?: string) {
const type = _type ? _type : 'home';
this.setState((prevState) => {

@ -148,21 +148,6 @@ class EventEdit extends React.PureComponent<PropsType> {
this.handleCloseToast = this.handleCloseToast.bind(this);
}
public UNSAFE_componentWillReceiveProps(nextProps: any) {
if ((this.props.collections !== nextProps.collections) ||
(this.props.initialCollection !== nextProps.initialCollection)) {
if (nextProps.initialCollection) {
this.setState({
journalUid: nextProps.initialCollection,
});
} else if (nextProps.collections[0]) {
this.setState({
journalUid: nextProps.collections[0].uid,
});
}
}
}
public handleChange(name: string, value: string) {
this.setState({
[name]: value,

@ -142,21 +142,6 @@ class TaskEdit extends React.PureComponent<PropsType> {
this.handleCloseToast = this.handleCloseToast.bind(this);
}
public UNSAFE_componentWillReceiveProps(nextProps: any) {
if ((this.props.collections !== nextProps.collections) ||
(this.props.initialCollection !== nextProps.initialCollection)) {
if (nextProps.initialCollection) {
this.setState({
journalUid: nextProps.initialCollection,
});
} else if (nextProps.collections[0]) {
this.setState({
journalUid: nextProps.collections[0].uid,
});
}
}
}
public handleChange(name: string, value: string | number | string[]) {
this.setState({
[name]: value,

Loading…
Cancel
Save