Skip to content

Commit

Permalink
Frontend lazy loading in profs view
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Jan 13, 2025
1 parent f1aa101 commit d39f6f2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions frontend/src/pages/Profs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ const Profs: React.FC<{ profList: ProfType[] | undefined }> = ({
return <FullPageLoader />;
}

if (displayProfs.length === 0 && profList.length !== 0) {
if (selectedProfs.length === 0 && profList.length !== 0) {
setSelectedProfs(profList);
setDisplayProfs(profList);
}

// it is enough to check length to assert full equality as selectedProfs is a
Expand Down Expand Up @@ -81,7 +80,7 @@ const Profs: React.FC<{ profList: ProfType[] | undefined }> = ({
size="small"
sx={{ minWidth: '95px' }}
>
{isFullSelection ? 'Clear filter' : 'Apply filter'}
{isFullSelection ? 'Display all' : 'Apply filter'}
</Button>
</span>
</Tooltip>
Expand All @@ -92,7 +91,7 @@ const Profs: React.FC<{ profList: ProfType[] | undefined }> = ({
sx={{ mb: 3, fontStyle: 'italic' }}
>
This filter allows you to select one or more professors to display
reviews for. To clear this filter and display all, leave this empty.
reviews for. Leave the field empty to display all review boxes.
</Typography>
<SortBox sortableData={displayProfs} setSortableData={setDisplayProfs} />
<Typography variant="h5" color="secondary" gutterBottom>
Expand All @@ -115,7 +114,7 @@ const Profs: React.FC<{ profList: ProfType[] | undefined }> = ({
color="text.primary"
sx={{ fontStyle: 'italic' }}
>
No reviews available.
Hit the display button to show reviews.
</Typography>
)}
</Container>
Expand Down

0 comments on commit d39f6f2

Please sign in to comment.