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) {
|
||||
return null
|
||||
}
|
||||
// Show CreateAnother only at the end of the list on own profile
|
||||
if (isMe && !hasNextPage && !isFetchingNextPage) {
|
||||
return <CreateAnother style={{paddingBottom: bottomBarOffset}} />
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<ListFooter
|
||||
isFetchingNextPage={isFetchingNextPage}
|
||||
hasNextPage={hasNextPage}
|
||||
error={isError ? 'Could not load more starter packs' : undefined}
|
||||
onRetry={fetchNextPage}
|
||||
style={!isMe ? {paddingBottom: bottomBarOffset} : undefined}
|
||||
/>
|
||||
{isMe && <CreateAnother style={{paddingBottom: bottomBarOffset}} />}
|
||||
</>
|
||||
<ListFooter
|
||||
isFetchingNextPage={isFetchingNextPage}
|
||||
hasNextPage={hasNextPage}
|
||||
error={isError ? 'Could not load more starter packs' : undefined}
|
||||
onRetry={fetchNextPage}
|
||||
style={{paddingBottom: bottomBarOffset}}
|
||||
/>
|
||||
)
|
||||
}, [
|
||||
data,
|
||||
|
||||
Reference in New Issue
Block a user