replace getDerivedStateFromProps with componentDidUpdate
This commit is contained in:
@@ -13,10 +13,12 @@ export default class ErrorPanel extends React.PureComponent {
|
|||||||
this.hide = this.hide.bind(this);
|
this.hide = this.hide.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(nextProps, prevState) {
|
componentDidUpdate(prevProps) {
|
||||||
return {
|
if (prevProps.level !== this.props.level) {
|
||||||
show: !(!nextProps.level)
|
this.setState({
|
||||||
};
|
show: !(!this.props.level)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
|
|||||||
+9
-8
@@ -6286,7 +6286,6 @@ var AvatarUpload = function (_React$Component) {
|
|||||||
key: "componentDidUpdate",
|
key: "componentDidUpdate",
|
||||||
value: function componentDidUpdate(prevProps) {
|
value: function componentDidUpdate(prevProps) {
|
||||||
if (this.props.avatar != prevProps.avatar) {
|
if (this.props.avatar != prevProps.avatar) {
|
||||||
console.log("parent changed the avatar", prevProps.avatar, this.props.avatar);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
dataUrl: this.props.avatar
|
dataUrl: this.props.avatar
|
||||||
});
|
});
|
||||||
@@ -7927,6 +7926,15 @@ var ErrorPanel = function (_React$PureComponent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_createClass(ErrorPanel, [{
|
_createClass(ErrorPanel, [{
|
||||||
|
key: "componentDidUpdate",
|
||||||
|
value: function componentDidUpdate(prevProps) {
|
||||||
|
if (prevProps.level !== this.props.level) {
|
||||||
|
this.setState({
|
||||||
|
show: !!this.props.level
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
key: "hide",
|
key: "hide",
|
||||||
value: function hide() {
|
value: function hide() {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -7966,13 +7974,6 @@ var ErrorPanel = function (_React$PureComponent) {
|
|||||||
onCancel: this.hide
|
onCancel: this.hide
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}], [{
|
|
||||||
key: "getDerivedStateFromProps",
|
|
||||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
||||||
return {
|
|
||||||
show: !!nextProps.level
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
return ErrorPanel;
|
return ErrorPanel;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user