Skip to content

Commit

Permalink
fixed loading psinner issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan Veer authored and Ishan Veer committed Oct 15, 2024
1 parent 9162eaa commit 31a8a1b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 1 addition & 5 deletions users/discord/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,21 @@ export const fetchUsers = async (tabId, page = 1) => {
if (newUsers.length > 0) {
if (page === 1) {
usersData[tabId] = newUsers; // Initial load
console.log('Fetched initial users');
} else {
const existingIds = new Set(usersData[tabId].map((user) => user.id));
const uniqueNewUsers = newUsers.filter(
(user) => !existingIds.has(user.id),
);
usersData[tabId] = [...usersData[tabId], ...uniqueNewUsers];
console.log('Fetched more users');
console.log(usersData[tabId]);
}
currentPage = page;
rerender(App(), document.getElementById('root'));
} else {
console.log('No more users to fetch');
}
} catch (error) {
console.error('Error fetching users', error);
} finally {
isLoading = false;
rerender(App(), document.getElementById('root'));
}
};

Expand Down
1 change: 0 additions & 1 deletion users/discord/components/UsersSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const UsersSection = ({
window.addEventListener(
'scroll',
debounce(() => {
console.log('scroll triggered');
if (window.innerHeight + window.scrollY >= document.body.offsetHeight) {
fetchUsers(activeTab, currentPage + 1);
}
Expand Down

0 comments on commit 31a8a1b

Please sign in to comment.