Merge branch 'my-groups-pagination' into 'develop'
Support pagination in My Groups See merge request soapbox-pub/soapbox!2455
This commit is contained in:
commit
584b3bb539
|
@ -30,12 +30,16 @@ const Groups: React.FC = () => {
|
||||||
const [searchValue, setSearchValue] = useState<string>('');
|
const [searchValue, setSearchValue] = useState<string>('');
|
||||||
const debouncedValue = debounce(searchValue, 300);
|
const debouncedValue = debounce(searchValue, 300);
|
||||||
|
|
||||||
const { groups, isLoading } = useGroups(debouncedValue);
|
const { groups, isLoading, hasNextPage, fetchNextPage } = useGroups(debouncedValue);
|
||||||
|
|
||||||
const createGroup = () => {
|
const handleLoadMore = () => {
|
||||||
dispatch(openModal('CREATE_GROUP'));
|
if (hasNextPage) {
|
||||||
|
fetchNextPage();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const createGroup = () => dispatch(openModal('CREATE_GROUP'));
|
||||||
|
|
||||||
const renderBlankslate = () => (
|
const renderBlankslate = () => (
|
||||||
<Stack space={4} alignItems='center' justifyContent='center' className='py-6'>
|
<Stack space={4} alignItems='center' justifyContent='center' className='py-6'>
|
||||||
<Stack space={2} className='max-w-sm'>
|
<Stack space={2} className='max-w-sm'>
|
||||||
|
@ -104,6 +108,8 @@ const Groups: React.FC = () => {
|
||||||
showLoading={isLoading && groups.length === 0}
|
showLoading={isLoading && groups.length === 0}
|
||||||
placeholderComponent={PlaceholderGroupCard}
|
placeholderComponent={PlaceholderGroupCard}
|
||||||
placeholderCount={3}
|
placeholderCount={3}
|
||||||
|
onLoadMore={handleLoadMore}
|
||||||
|
hasMore={hasNextPage}
|
||||||
>
|
>
|
||||||
{groups.map((group) => (
|
{groups.map((group) => (
|
||||||
<Link key={group.id} to={`/group/${group.slug}`}>
|
<Link key={group.id} to={`/group/${group.slug}`}>
|
||||||
|
|
Loading…
Reference in New Issue