Show CreateAnother only at end of list on own profile
CreateAnother replaces ListFooter only when: - Viewing own profile (isMe) - No more pages to load (!hasNextPage) - Not currently fetching (!isFetchingNextPage) Otherwise show ListFooter for pagination/loading state.
This commit is contained in:
@@ -164,17 +164,18 @@ export function ProfileStarterPacks({
|
|||||||
if (!data || items?.length === 0) {
|
if (!data || items?.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
// Show CreateAnother only at the end of the list on own profile
|
||||||
|
if (isMe && !hasNextPage && !isFetchingNextPage) {
|
||||||
|
return <CreateAnother style={{paddingBottom: bottomBarOffset}} />
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<ListFooter
|
||||||
<ListFooter
|
isFetchingNextPage={isFetchingNextPage}
|
||||||
isFetchingNextPage={isFetchingNextPage}
|
hasNextPage={hasNextPage}
|
||||||
hasNextPage={hasNextPage}
|
error={isError ? 'Could not load more starter packs' : undefined}
|
||||||
error={isError ? 'Could not load more starter packs' : undefined}
|
onRetry={fetchNextPage}
|
||||||
onRetry={fetchNextPage}
|
style={{paddingBottom: bottomBarOffset}}
|
||||||
style={!isMe ? {paddingBottom: bottomBarOffset} : undefined}
|
/>
|
||||||
/>
|
|
||||||
{isMe && <CreateAnother style={{paddingBottom: bottomBarOffset}} />}
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}, [
|
}, [
|
||||||
data,
|
data,
|
||||||
|
|||||||
Reference in New Issue
Block a user