mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Update search results profiles properly on refresh and handle scrollHeight error
This commit is contained in:
parent
7e59440abb
commit
d563bf1152
2 changed files with 18 additions and 4 deletions
|
|
@ -321,7 +321,7 @@ export default class PostsView extends React.Component {
|
|||
if (this.refs.newMessageSeparator) {
|
||||
var objDiv = this.refs.postlist;
|
||||
objDiv.scrollTop = this.refs.newMessageSeparator.offsetTop; //scrolls node to top of Div
|
||||
} else {
|
||||
} else if (this.refs.postlist) {
|
||||
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,7 +61,15 @@ export default class SearchResults extends React.Component {
|
|||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return !Utils.areObjectsEqual(this.props, nextProps) || !Utils.areObjectsEqual(this.state, nextState);
|
||||
if (!Utils.areObjectsEqual(this.props, nextProps)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Utils.areObjectsEqual(this.state, nextState)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
|
|
@ -143,13 +151,19 @@ export default class SearchResults extends React.Component {
|
|||
);
|
||||
} else {
|
||||
ctls = results.order.map(function mymap(id) {
|
||||
var post = results.posts[id];
|
||||
const post = results.posts[id];
|
||||
let profile;
|
||||
if (UserStore.getCurrentId() === post.user_id) {
|
||||
profile = UserStore.getCurrentUser();
|
||||
} else {
|
||||
profile = profiles[post.user_id];
|
||||
}
|
||||
return (
|
||||
<SearchResultsItem
|
||||
key={post.id}
|
||||
channel={this.state.channels.get(post.channel_id)}
|
||||
post={post}
|
||||
user={profiles[post.user_id]}
|
||||
user={profile}
|
||||
term={searchTerm}
|
||||
isMentionSearch={this.props.isMentionSearch}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue