-
Notifications
You must be signed in to change notification settings - Fork 16
fix: Once loaded, only campaign Grades and Subjects are shown. #4743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,9 +180,7 @@ const CampaignAssignmentTab: React.FC<CampaignAssignmentTabProps> = ({ | |
| subjects.flatMap((subject) => subject.gradeIds), | ||
| ); | ||
|
|
||
| return relevantGradeIds.size === 0 | ||
| ? grades | ||
| : grades.filter((grade) => relevantGradeIds.has(grade.id)); | ||
| return grades.filter((grade) => relevantGradeIds.has(grade.id)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| }, [grades, subjects]); | ||
|
|
||
| useEffect(() => { | ||
|
|
@@ -302,7 +300,10 @@ const CampaignAssignmentTab: React.FC<CampaignAssignmentTabProps> = ({ | |
| <FormControl | ||
| size="small" | ||
| className="campaign-assignment-filter" | ||
| disabled={isLoadingFilters} | ||
| disabled={ | ||
| isLoadingFilters || | ||
| (isLoadingAssignments && subjects.length === 0) | ||
| } | ||
| > | ||
| <Select | ||
| multiple | ||
|
|
@@ -362,7 +363,10 @@ const CampaignAssignmentTab: React.FC<CampaignAssignmentTabProps> = ({ | |
| <FormControl | ||
| size="small" | ||
| className="campaign-assignment-filter campaign-assignment-filterField" | ||
| disabled={isLoadingFilters} | ||
| disabled={ | ||
| isLoadingFilters || | ||
| (isLoadingAssignments && subjects.length === 0) | ||
| } | ||
| > | ||
| <Select | ||
| multiple | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current test has a false-positive risk. It asserts that the filters are disabled immediately after
api.getAllGradesis called, but before the promise resolves. At this point,isLoadingFiltersis stilltrue, so the filters are disabled regardless of the new logic. To make the test robust, we should resolveapi.getAllGradesand verify that the filters remain disabled while assignments are loading, and then verify they become enabled once assignments resolve.