Web.Components/Client: Layout: fixed missing render in profile-actions sub-component in the case of changing user data or avatar

This commit is contained in:
Daniil Senkiv 2019-10-08 10:34:09 +03:00
parent 838a56f6b7
commit 1d2ba0d5de
3 changed files with 11 additions and 8 deletions

View File

@ -6,15 +6,12 @@ import { Layout, Toast } from "asc-web-components";
import { logout } from "../../store/auth/actions";
import { withTranslation, I18nextProvider } from 'react-i18next';
import i18n from "./i18n";
import isEqual from "lodash/isEqual";
class PureStudioLayout extends React.Component {
shouldComponentUpdate(nextProps) {
if(this.props.hasChanges !== nextProps.hasChanges) {
return true;
}
return false;
}
shouldComponentUpdate(nextProps, nextState) {
return !isEqual(this.props, nextProps) || !isEqual(this.state, nextState);
}
onProfileClick = () => {
window.location.href = "/products/people/view/@self";

View File

@ -36,7 +36,8 @@ class Layout extends React.Component {
hash += props.currentModuleId;
}
if (props.currentUser) {
hash += props.currentUser.id;
const { id, displayName, email, avatarSmall } = props.currentUser;
hash += id + displayName + email + avatarSmall;
}
if (props.availableModules) {
for (let i = 0, l = props.availableModules.length; i < l; i++) {

View File

@ -42,6 +42,11 @@ class ProfileActions extends React.PureComponent {
}
componentDidUpdate(prevProps, prevState) {
if (this.props.user !== prevProps.user) {
this.setState({ user: this.props.user })
}
if (this.props.opened !== prevProps.opened) {
this.toggle(this.props.opened);
}