Skip to content

Commit

Permalink
Infinite scroll triggered, more profiles not rendering #66
Browse files Browse the repository at this point in the history
the correct API response is received with the additional profiles, but not rendered
  • Loading branch information
blahosyl committed Aug 10, 2024
1 parent 25d4106 commit 902a4bd
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/pages/profiles/ProfileList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import { useCurrentUser } from "../../contexts/CurrentUserContext";
import InfiniteScroll from "react-infinite-scroll-component";
import { fetchMoreData } from "../../utils/utils";

console.log(useSetProfileData)

/**
* Render the list of profiles from most to least recently updated
*/
const ProfileList = () => {
const { profileList } = useProfileData();
const { setProfileData } = useSetProfileData();
// const { setProfileData } = useSetProfileData();
const currentUser = useCurrentUser();
console.log('profileList', profileList)
console.log('profileList.results.length', profileList.results.length)
Expand All @@ -26,7 +24,13 @@ const ProfileList = () => {
return (
// only render the component if a user is logged in
currentUser && (
<Container className={appStyles.Content}>
<Container
className={`
${appStyles.Content}
// overflowY: "scroll"
`}
// id="scrollableDiv"
>
{/* if profiles are loaded, render them using the Profile component */}
{profileList.results.length ? (
<>
Expand All @@ -46,9 +50,14 @@ const ProfileList = () => {
)}
dataLength={profileList.results.length}
loader={<Asset spinner />}
height={400}
hasMore={!!profileList.next}
scrollThreshold={5}
next={() => {fetchMoreData(useProfileData, useSetProfileData)}
endMessage={"You have viewed all teammates"}
// scrollableTarget="scrollableDiv"
next={() => {
fetchMoreData(useProfileData, useSetProfileData)
fetchMoreData(profileList, useProfileData)
}
}
/>
</>
Expand Down

0 comments on commit 902a4bd

Please sign in to comment.