From ff17f69e7bede0f176223566abc2047d3ea2e665 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 18 Jan 2019 13:09:54 +0300 Subject: Fix Avatar reload on url change --- vnext/src/components/Avatar.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vnext/src/components/Avatar.js') diff --git a/vnext/src/components/Avatar.js b/vnext/src/components/Avatar.js index a83107ce..660847f2 100644 --- a/vnext/src/components/Avatar.js +++ b/vnext/src/components/Avatar.js @@ -27,6 +27,15 @@ class Avatar extends React.Component { }); } } + shouldComponentUpdate(nextProps, nextState) { + return this.state.user.avatar != nextState.user.avatar || this.state.user.uid != nextState.user.uid + || this.props.user.avatar != nextProps.user.avatar || this.props.user.uid != nextProps.user.uid; + } + componentDidUpdate(prevProps, prevState, shouldReload) { + this.setState({ + user: this.props.user + }); + } render() { let user = this.state.user; return ( -- cgit v1.2.3