Final commit on replacing componentWillReceiveProps deprecated method
This commit is contained in:
parent
3d29f7b6e2
commit
81f9a1da3a
|
@ -41,7 +41,7 @@ class Reblogs extends ImmutablePureComponent {
|
||||||
this.props.dispatch(fetchStatus(this.props.params.statusId));
|
this.props.dispatch(fetchStatus(this.props.params.statusId));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
||||||
this.props.dispatch(fetchReblogs(nextProps.params.statusId));
|
this.props.dispatch(fetchReblogs(nextProps.params.statusId));
|
||||||
this.props.dispatch(fetchStatus(nextProps.params.statusId));
|
this.props.dispatch(fetchStatus(nextProps.params.statusId));
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Header extends ImmutablePureComponent {
|
||||||
submittedValue: '',
|
submittedValue: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (nextProps.submitted) {
|
if (nextProps.submitted) {
|
||||||
const submittedValue = nextProps.value;
|
const submittedValue = nextProps.value;
|
||||||
this.setState({ submittedValue });
|
this.setState({ submittedValue });
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class Card extends React.PureComponent {
|
||||||
embedded: false,
|
embedded: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (!Immutable.is(this.props.card, nextProps.card)) {
|
if (!Immutable.is(this.props.card, nextProps.card)) {
|
||||||
this.setState({ embedded: false });
|
this.setState({ embedded: false });
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,17 +147,6 @@ class Status extends ImmutablePureComponent {
|
||||||
attachFullscreenListener(this.onFullScreenChange);
|
attachFullscreenListener(this.onFullScreenChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
|
||||||
this._scrolledIntoView = false;
|
|
||||||
this.props.dispatch(fetchStatus(nextProps.params.statusId));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextProps.status && nextProps.status.get('id') !== this.state.loadedStatusId) {
|
|
||||||
this.setState({ showMedia: defaultMediaVisibility(nextProps.status), loadedStatusId: nextProps.status.get('id') });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleToggleMediaVisibility = () => {
|
handleToggleMediaVisibility = () => {
|
||||||
this.setState({ showMedia: !this.state.showMedia });
|
this.setState({ showMedia: !this.state.showMedia });
|
||||||
}
|
}
|
||||||
|
@ -404,7 +393,16 @@ class Status extends ImmutablePureComponent {
|
||||||
this.node = c;
|
this.node = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate(nextProps) {
|
||||||
|
if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) {
|
||||||
|
this._scrolledIntoView = false;
|
||||||
|
this.props.dispatch(fetchStatus(nextProps.params.statusId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextProps.status && nextProps.status.get('id') !== this.state.loadedStatusId) {
|
||||||
|
this.setState({ showMedia: defaultMediaVisibility(nextProps.status), loadedStatusId: nextProps.status.get('id') });
|
||||||
|
}
|
||||||
|
|
||||||
if (this._scrolledIntoView) {
|
if (this._scrolledIntoView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Bundle extends React.PureComponent {
|
||||||
this.load(this.props);
|
this.load(this.props);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.fetchComponent !== this.props.fetchComponent) {
|
if (nextProps.fetchComponent !== this.props.fetchComponent) {
|
||||||
this.load(nextProps);
|
this.load(nextProps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
this.updatePositionFromMedia(this.props.media);
|
this.updatePositionFromMedia(this.props.media);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (this.props.media.get('id') !== nextProps.media.get('id')) {
|
if (this.props.media.get('id') !== nextProps.media.get('id')) {
|
||||||
this.updatePositionFromMedia(nextProps.media);
|
this.updatePositionFromMedia(nextProps.media);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default class ImageLoader extends React.PureComponent {
|
||||||
this.loadImage(this.props);
|
this.loadImage(this.props);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (this.props.src !== nextProps.src) {
|
if (this.props.src !== nextProps.src) {
|
||||||
this.loadImage(nextProps);
|
this.loadImage(nextProps);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class ReportModal extends ImmutablePureComponent {
|
||||||
this.props.dispatch(expandAccountTimeline(this.props.account.get('id'), { withReplies: true }));
|
this.props.dispatch(expandAccountTimeline(this.props.account.get('id'), { withReplies: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentDidUpdate(nextProps) {
|
||||||
if (this.props.account !== nextProps.account && nextProps.account) {
|
if (this.props.account !== nextProps.account && nextProps.account) {
|
||||||
this.props.dispatch(expandAccountTimeline(nextProps.account.get('id'), { withReplies: true }));
|
this.props.dispatch(expandAccountTimeline(nextProps.account.get('id'), { withReplies: true }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,7 +291,7 @@ class Video extends React.PureComponent {
|
||||||
document.removeEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
|
document.removeEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
|
if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
|
||||||
this.setState({ revealed: nextProps.visible });
|
this.setState({ revealed: nextProps.visible });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue