fix avatar not being updated while edited

This commit is contained in:
or-else
2019-08-06 17:18:28 +03:00
parent d782fb8eab
commit d2975f0c20
5 changed files with 16 additions and 20 deletions
+10 -11
View File
@@ -6283,6 +6283,16 @@ var AvatarUpload = function (_React$Component) {
}
_createClass(AvatarUpload, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.avatar != prevProps.avatar) {
console.log("parent changed the avatar", prevProps.avatar, this.props.avatar);
this.setState({
dataUrl: this.props.avatar
});
}
}
}, {
key: "handleFileUpload",
value: function handleFileUpload(e) {
var _this2 = this;
@@ -6344,17 +6354,6 @@ var AvatarUpload = function (_React$Component) {
className: "material-icons"
}, "file_upload")));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
if (prevState.dataUrl != nextProps.avatar) {
return {
dataUrl: nextProps.avatar
};
}
return null;
}
}]);
return AvatarUpload;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long