Fix directory scroll position reset (#34560)
Some checks failed
Check i18n / check-i18n (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Check formatting / lint (push) Has been cancelled
JavaScript Linting / lint (push) Has been cancelled
JavaScript Testing / test (push) Has been cancelled
Ruby Testing / build (production) (push) Has been cancelled
Ruby Testing / build (test) (push) Has been cancelled
Ruby Testing / test (.ruby-version) (push) Has been cancelled
Ruby Testing / test (3.2) (push) Has been cancelled
Ruby Testing / test (3.3) (push) Has been cancelled
Ruby Testing / Libvips tests (.ruby-version) (push) Has been cancelled
Ruby Testing / Libvips tests (3.2) (push) Has been cancelled
Ruby Testing / Libvips tests (3.3) (push) Has been cancelled
Ruby Testing / End to End testing (.ruby-version) (push) Has been cancelled
Ruby Testing / End to End testing (3.2) (push) Has been cancelled
Ruby Testing / End to End testing (3.3) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Has been cancelled

This commit is contained in:
Patryk Rzucidło 2025-04-30 14:27:37 +02:00 committed by GitHub
parent 05f6f7d28a
commit e3f0b955b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -1,24 +1,32 @@
import { FormattedMessage } from 'react-intl';
import { LoadingIndicator } from './loading_indicator';
interface Props {
onClick: (event: React.MouseEvent) => void;
disabled?: boolean;
visible?: boolean;
loading?: boolean;
}
export const LoadMore: React.FC<Props> = ({
onClick,
disabled,
visible = true,
loading = false,
}) => {
return (
<button
type='button'
className='load-more'
disabled={disabled || !visible}
disabled={disabled || loading || !visible}
style={{ visibility: visible ? 'visible' : 'hidden' }}
onClick={onClick}
>
<FormattedMessage id='status.load_more' defaultMessage='Load more' />
{loading ? (
<LoadingIndicator />
) : (
<FormattedMessage id='status.load_more' defaultMessage='Load more' />
)}
</button>
);
};

View File

@ -130,6 +130,7 @@ export const Directory: React.FC<{
}, [dispatch, order, local]);
const pinned = !!columnId;
const initialLoad = isLoading && accountIds.size === 0;
const scrollableArea = (
<div className='scrollable'>
@ -170,7 +171,7 @@ export const Directory: React.FC<{
</div>
<div className='directory__list'>
{isLoading ? (
{initialLoad ? (
<LoadingIndicator />
) : (
accountIds.map((accountId) => (
@ -179,7 +180,11 @@ export const Directory: React.FC<{
)}
</div>
<LoadMore onClick={handleLoadMore} visible={!isLoading} />
<LoadMore
onClick={handleLoadMore}
visible={!initialLoad}
loading={isLoading}
/>
</div>
);