Skip to content

Commit

Permalink
Fix orgList screen refreshing entire data on load more orgs (#1525)
Browse files Browse the repository at this point in the history
* Fix orgList screen refreshing entire data on load more orgs

* update schema for passing test

* restore verified code

---------

Co-authored-by: Nay Oo Lwin <[email protected]>
  • Loading branch information
NayOoLwin5 and Nay Oo Lwin authored Feb 4, 2024
1 parent 455be65 commit 780d70f
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions src/screens/OrgList/OrgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,50 +464,49 @@ function orgList(): JSX.Element {
</div>
}
>
{isLoading ? (
<>
{[...Array(perPageResult)].map((_, index) => (
<div key={index} className={styles.itemCard}>
<div className={styles.loadingWrapper}>
<div className={styles.innerContainer}>
<div
className={`${styles.orgImgContainer} shimmer`}
></div>
<div className={styles.content}>
<h5 className="shimmer" title="Org name"></h5>
<h6 className="shimmer" title="Location"></h6>
<h6 className="shimmer" title="Admins"></h6>
<h6 className="shimmer" title="Members"></h6>
</div>
</div>
<div className={`shimmer ${styles.button}`} />
</div>
</div>
))}
</>
) : userData && userData.user.userType == 'SUPERADMIN' ? (
orgsData?.organizationsConnection.map((item) => {
return (
<div key={item._id} className={styles.itemCard}>
<OrgListCard data={item} />
</div>
);
})
) : (
userData &&
userData.user.userType == 'ADMIN' &&
userData.user.adminFor.length > 0 &&
orgsData?.organizationsConnection.map((item) => {
if (isAdminForCurrentOrg(item)) {
{userData && userData.user.userType == 'SUPERADMIN'
? orgsData?.organizationsConnection.map((item) => {
return (
<div key={item._id} className={styles.itemCard}>
<OrgListCard data={item} />
</div>
);
}
})
)}
})
: userData &&
userData.user.userType == 'ADMIN' &&
userData.user.adminFor.length > 0 &&
orgsData?.organizationsConnection.map((item) => {
if (isAdminForCurrentOrg(item)) {
return (
<div key={item._id} className={styles.itemCard}>
<OrgListCard data={item} />
</div>
);
}
})}
</InfiniteScroll>
{isLoading && (
<>
{[...Array(perPageResult)].map((_, index) => (
<div key={index} className={styles.itemCard}>
<div className={styles.loadingWrapper}>
<div className={styles.innerContainer}>
<div
className={`${styles.orgImgContainer} shimmer`}
></div>
<div className={styles.content}>
<h5 className="shimmer" title="Org name"></h5>
<h6 className="shimmer" title="Location"></h6>
<h6 className="shimmer" title="Admins"></h6>
<h6 className="shimmer" title="Members"></h6>
</div>
</div>
<div className={`shimmer ${styles.button}`} />
</div>
</div>
))}
</>
)}
</>
)}
{/* Create Organization Modal */}
Expand Down

0 comments on commit 780d70f

Please sign in to comment.