Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-14456 Show search loading indicator until we have no more posts to load to avoid scroll pop #2684

Merged
merged 4 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions components/search_results/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getSearchMatches, getSearchResults} from 'mattermost-redux/selectors/entities/posts';
import * as PreferenceSelectors from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import {getCurrentSearchForCurrentTeam} from 'mattermost-redux/selectors/entities/search';

import {
getSearchResultsTerms,
Expand Down Expand Up @@ -54,6 +55,8 @@ function makeMapStateToProps() {
});
}

const currentSearch = getCurrentSearchForCurrentTeam(state) || {};

return {
results: posts,
matches: getSearchMatches(state),
Expand All @@ -63,6 +66,7 @@ function makeMapStateToProps() {
isSearchingFlaggedPost: getIsSearchingFlaggedPost(state),
isSearchingPinnedPost: getIsSearchingPinnedPost(state),
isSearchGettingMore: getIsSearchGettingMore(state),
isSearchAtEnd: currentSearch.isEnd,
compactDisplay: PreferenceSelectors.get(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) === Preferences.MESSAGE_DISPLAY_COMPACT,
dataRetentionEnableMessageDeletion,
dataRetentionMessageRetentionDays,
Expand Down
9 changes: 5 additions & 4 deletions components/search_results/search_results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default class SearchResults extends React.PureComponent {
isSearchingFlaggedPost: PropTypes.bool,
isSearchingPinnedPost: PropTypes.bool,
isSearchGettingMore: PropTypes.bool,
isSearchAtEnd: PropTypes.bool,
compactDisplay: PropTypes.bool,
isMentionSearch: PropTypes.bool,
isFlaggedPosts: PropTypes.bool,
Expand Down Expand Up @@ -195,9 +196,9 @@ export default class SearchResults extends React.PureComponent {
}, this);
}

let loadingScreen = null;
if (this.props.isSearchGettingMore) {
loadingScreen = (
let loadingMorePostsComponent = null;
if (!this.props.isSearchAtEnd) {
loadingMorePostsComponent = (
<div className='loading-screen'>
<div className='loading__content'>
<div className='round round-1'/>
Expand Down Expand Up @@ -232,9 +233,9 @@ export default class SearchResults extends React.PureComponent {
className='search-items-container'
>
{ctls}
{loadingMorePostsComponent}
</div>
</Scrollbars>
{loadingScreen}
</div>
);
}
Expand Down
30 changes: 10 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.