Skip to content

Commit

Permalink
Merge pull request #2379 from ever-co/2378-bug-re-rendering-issue-in-…
Browse files Browse the repository at this point in the history
…user-profile-page

[Bug]: Re-rendering issue in user profile page
  • Loading branch information
evereq authored Apr 19, 2024
2 parents c8f25ee + 73f0995 commit 14bcd67
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions apps/web/app/hooks/useInfinityFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ export const useInfinityScrolling = <T>(arr: T[], lim?: number) => {

const getSomeTasks = React.useCallback(
(offset: number) => {
setData(() => {
const newData = getPartData({ arr, limit, offset });
return newData;
});
if (arr.length > 0) {
setData(() => {
const newData = getPartData({ arr, limit, offset });
return newData;
});
}
},
[arr, limit]
);

const nextOffset = React.useCallback(() => {
setOffset((prev) => prev + 1);
}, []);
if (arr.length > 0) {
setOffset((prev) => prev + 1);
}
}, [arr.length]);

React.useEffect(() => {
getSomeTasks(offset);
Expand Down
1 change: 1 addition & 0 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const nextConfig = {
domains: [
'dummyimage.com',
'res.cloudinary.com',
'gauzy.sfo2.digitaloceanspaces.com',

Check warning on line 77 in apps/web/next.config.js

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (digitaloceanspaces)
'localhost',
'127.0.0.1',
'cdn-icons-png.flaticon.com', // Remove this domain once the Backend Icons list is added
Expand Down

0 comments on commit 14bcd67

Please sign in to comment.