Skip to content

Commit

Permalink
Merge pull request #2202 from ever-co/fix/profile
Browse files Browse the repository at this point in the history
Fix: profile infinity scroll and Tab (Tickets) data
  • Loading branch information
evereq authored Feb 12, 2024
2 parents 626bec0 + 3e8596a commit 849e7d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion apps/web/app/[locale]/profile/[memberId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ const Profile = React.memo(function ProfilePage({ params }: { params: { memberId
)}

<Container fullWidth={fullWidth} className="mb-10">
{activityScreens[activityFilter] ?? null}
{hook.tab !== 'worked' ? (
<UserProfileTask profile={profile} tabFiltered={hook} />
) : (
activityScreens[activityFilter] ?? null
)}
</Container>
</MainLayout>
</>
Expand Down
1 change: 0 additions & 1 deletion apps/web/app/hooks/useInfinityFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const useInfinityScrolling = <T>(arr: T[], lim?: number) => {
}, [limit, offset]);

React.useEffect(() => {
console.log({ offset });
getSomeTasks(offset);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [offset]);
Expand Down
3 changes: 2 additions & 1 deletion apps/web/lib/features/user-profile-tasks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function UserProfileTask({ profile, tabFiltered }: Props) {
profile.member?.running == true ? t.id !== profile.activeUserTeamTask?.id : t
);
const { nextOffset, data } = useInfinityScrolling(otherTasks);
const dataTodisplay = otherTasks.length > 10 ? otherTasks : data;

Check warning on line 34 in apps/web/lib/features/user-profile-tasks.tsx

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Todisplay)
// const { total, onPageChange, itemsPerPage, itemOffset, endOffset, setItemsPerPage, currentItems } =
// usePagination(otherTasks);

Expand Down Expand Up @@ -84,7 +85,7 @@ export function UserProfileTask({ profile, tabFiltered }: Props) {
)}

<ul className="flex flex-col gap-6">
{data.map((task, index) => {
{dataTodisplay.map((task, index) => {

Check warning on line 88 in apps/web/lib/features/user-profile-tasks.tsx

View workflow job for this annotation

GitHub Actions / Cspell

Unknown word (Todisplay)
return (
<li key={task.id}>
<ObserverComponent isLast={index === data.length - 1} getNextData={nextOffset} />
Expand Down

0 comments on commit 849e7d5

Please sign in to comment.