Skip to content

Commit

Permalink
Set fetching true when fetching on load and checking if fetching is s…
Browse files Browse the repository at this point in the history
…till true when hgetting members
  • Loading branch information
Luukosaurus committed May 23, 2024
1 parent a60d641 commit b4d5993
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/components/members/memberlist.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function MemberList({ search }: { search: string }) {

async function getMemberList() {
let newMembers: Members = {} as Members;

if (!isFetching) return;
try {
// is there a next link then load it, if not but there are no members loaded yet this is the first load, load them otherwise there are no more members to load.
if (next) {
Expand Down Expand Up @@ -45,6 +45,7 @@ export default function MemberList({ search }: { search: string }) {
}

useEffect(() => {
setIsFetching(true);
getMemberList();
window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll);
Expand Down

0 comments on commit b4d5993

Please sign in to comment.