Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USER STORY: Infinite scroll for Profiles #66

Closed
2 tasks done
blahosyl opened this issue Aug 4, 2024 · 7 comments
Closed
2 tasks done

USER STORY: Infinite scroll for Profiles #66

blahosyl opened this issue Aug 4, 2024 · 7 comments
Assignees
Labels
e: ux profiles Epic: UX for Profiles p: should have Priority: High value but not crucial tutoring Consulted tutoring on this issue

Comments

@blahosyl
Copy link
Owner

blahosyl commented Aug 4, 2024

As a Use,

I want to browse profiles continuously,

so that I do not have to click a button to load more profiles

Acceptance Criteria

  1. Profiles load automatically without the user having to click "next"
  2. Spinner is showing while profiles are loading

Tasks

  • install infinite scroll component npm install react-infinite-scroll-component(if not already installed)
  • [x]create fetchMoreData in utils (if not already created)
  • in ProfileList component, call Profile inside InfiniteScroll, with fetchMoreData in the next prop
@blahosyl blahosyl self-assigned this Aug 4, 2024
@blahosyl blahosyl added p: should have Priority: High value but not crucial e: ux profiles Epic: UX for Profiles blocked Waiting for input or for another work phase to finish labels Aug 4, 2024
@blahosyl
Copy link
Owner Author

blahosyl commented Aug 4, 2024

Blocked by #59

@blahosyl blahosyl added this to the Sprint 2 milestone Aug 4, 2024
@blahosyl blahosyl moved this to Backlog in Task Manager Aug 4, 2024
@blahosyl blahosyl moved this from Backlog to Blocked/Ongoig in Task Manager Aug 4, 2024
@blahosyl blahosyl moved this from Blocked/Ongoig to Todo in Task Manager Aug 5, 2024
@blahosyl blahosyl added p: could have Priority: Nice to have and removed blocked Waiting for input or for another work phase to finish p: should have Priority: High value but not crucial labels Aug 5, 2024
@blahosyl blahosyl added p: must have Priority: Part of the MVP and removed p: could have Priority: Nice to have labels Aug 9, 2024
@blahosyl blahosyl moved this from Todo to In Progress in Task Manager Aug 9, 2024
blahosyl added a commit that referenced this issue Aug 10, 2024
with some suggestions by tutor John
@blahosyl blahosyl moved this from Blocked/Ongoig to In Progress in Task Manager Aug 10, 2024
@blahosyl blahosyl added bug Something isn't working tutoring Consulted tutoring on this issue labels Aug 10, 2024
blahosyl added a commit that referenced this issue Aug 10, 2024
the correct API response is received with the additional profiles, but not rendered
@blahosyl blahosyl added help wanted Extra attention is needed p: should have Priority: High value but not crucial and removed p: must have Priority: Part of the MVP labels Aug 10, 2024
@blahosyl
Copy link
Owner Author

Contacted tutor support: John determined that InfiniteScroll was not even triggering. He tried several remediations, including hardcoding the dataLength, destructuring the setProfileData function and removing my conditional test that cuts out the one profile, but nothing worked.

@blahosyl
Copy link
Owner Author

blahosyl commented Aug 10, 2024

After some more searching on Stackoverflow, I found some suggestions that had to do with fixing the height of InfiniteScroll (or its container div.)

Adding 'id="scrollableDiv"' to the parent container of InfiniteScroll and 'scrollableTarget="scrollableDiv"' to InfiniteScroll did not work.

Adding height={400} to the props of InfiniteScroll finally triggered the loader and retrieved the next page of profile objects from the API. However, these are not rendered, and the component shows the spinner indefinitely.

Image

Image

@blahosyl
Copy link
Owner Author

blahosyl commented Aug 10, 2024

As for the next prop of InfiniteScroll, fetchMoreData(useProfileData, useSetProfileData) does not make the right API call. The API call is determined by the 1st argument (resource in teh fetchMoreData() definition).

Thus, but both fetchMoreData(profileList, useSetProfileData) and fetchMoreData(profileList, useProfileData) make the right API call, but profileList.results is not updated. This could be down to the 2nd argument being wrong.

@blahosyl
Copy link
Owner Author

An alternative fix to InfiniteScroll not triggering is to set the following CSS properties on its container.

overflow: hidden; /* Hide any overflow beyond the content's size */
height: 100vh; /* Set the height equal to the viewport height to limit scrolling */

The rest of the suggestion does not seem to change much.

@blahosyl blahosyl moved this from In Progress to Blocked/Ongoig in Task Manager Aug 10, 2024
blahosyl added a commit that referenced this issue Aug 10, 2024
@blahosyl blahosyl moved this from Blocked/Ongoig to In Progress in Task Manager Aug 11, 2024
@blahosyl
Copy link
Owner Author

Solution by John Rearden: use a custom API call instead of using fetchMoreData()

@github-project-automation github-project-automation bot moved this from In Progress to Done in Task Manager Aug 11, 2024
@blahosyl blahosyl removed bug Something isn't working help wanted Extra attention is needed labels Aug 11, 2024
blahosyl added a commit that referenced this issue Aug 11, 2024
@blahosyl blahosyl moved this from Done to In Progress in Task Manager Aug 11, 2024
@blahosyl blahosyl reopened this Aug 11, 2024
@blahosyl
Copy link
Owner Author

Make ProfileList div scrollable

blahosyl added a commit that referenced this issue Aug 11, 2024
blahosyl added a commit that referenced this issue Aug 11, 2024
@blahosyl blahosyl moved this from In Progress to Done in Task Manager Aug 11, 2024
@blahosyl blahosyl closed this as completed by moving to Done in Task Manager Aug 11, 2024
blahosyl added a commit that referenced this issue Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: ux profiles Epic: UX for Profiles p: should have Priority: High value but not crucial tutoring Consulted tutoring on this issue
Projects
Status: Done/Won't do
Development

No branches or pull requests

1 participant