[Glitch] Fix search results temporarily disappearing while scrolling and loading more results

Port 5356ddbcca to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
lolsob-rspec
Claire 2023-09-21 13:51:21 +02:00
parent f05985f8ec
commit 6760e67c64
1 changed files with 34 additions and 36 deletions

View File

@ -156,45 +156,43 @@ class Results extends PureComponent {
let filteredResults; let filteredResults;
if (!isLoading) { const accounts = results.get('accounts', ImmutableList());
const accounts = results.get('accounts', ImmutableList()); const hashtags = results.get('hashtags', ImmutableList());
const hashtags = results.get('hashtags', ImmutableList()); const statuses = results.get('statuses', ImmutableList());
const statuses = results.get('statuses', ImmutableList());
switch(type) { switch(type) {
case 'all': case 'all':
filteredResults = (accounts.size + hashtags.size + statuses.size) > 0 ? ( filteredResults = (accounts.size + hashtags.size + statuses.size) > 0 ? (
<> <>
{accounts.size > 0 && ( {accounts.size > 0 && (
<SearchSection key='accounts' title={<><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></>} onClickMore={this.handleLoadMoreAccounts}> <SearchSection key='accounts' title={<><Icon id='users' fixedWidth /><FormattedMessage id='search_results.accounts' defaultMessage='Profiles' /></>} onClickMore={this.handleLoadMoreAccounts}>
{accounts.take(INITIAL_DISPLAY).map(id => <Account key={id} id={id} />)} {accounts.take(INITIAL_DISPLAY).map(id => <Account key={id} id={id} />)}
</SearchSection> </SearchSection>
)} )}
{hashtags.size > 0 && ( {hashtags.size > 0 && (
<SearchSection key='hashtags' title={<><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></>} onClickMore={this.handleLoadMoreHashtags}> <SearchSection key='hashtags' title={<><Icon id='hashtag' fixedWidth /><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></>} onClickMore={this.handleLoadMoreHashtags}>
{hashtags.take(INITIAL_DISPLAY).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)} {hashtags.take(INITIAL_DISPLAY).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
</SearchSection> </SearchSection>
)} )}
{statuses.size > 0 && ( {statuses.size > 0 && (
<SearchSection key='statuses' title={<><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></>} onClickMore={this.handleLoadMoreStatuses}> <SearchSection key='statuses' title={<><Icon id='quote-right' fixedWidth /><FormattedMessage id='search_results.statuses' defaultMessage='Posts' /></>} onClickMore={this.handleLoadMoreStatuses}>
{statuses.take(INITIAL_DISPLAY).map(id => <Status key={id} id={id} />)} {statuses.take(INITIAL_DISPLAY).map(id => <Status key={id} id={id} />)}
</SearchSection> </SearchSection>
)} )}
</> </>
) : []; ) : [];
break; break;
case 'accounts': case 'accounts':
filteredResults = renderAccounts(accounts); filteredResults = renderAccounts(accounts);
break; break;
case 'hashtags': case 'hashtags':
filteredResults = renderHashtags(hashtags); filteredResults = renderHashtags(hashtags);
break; break;
case 'statuses': case 'statuses':
filteredResults = renderStatuses(statuses); filteredResults = renderStatuses(statuses);
break; break;
}
} }
return ( return (