Skip to content

Commit

Permalink
Fix bug with clearing topics input on match page
Browse files Browse the repository at this point in the history
* When clearing the input field, topics is temporarily set to null before the onClear event is emitted
* This causes hasQuestionsValidator to reference a null variable
* The fix is to add an additional Validators.required to prevent hasQuestionsValidator from firing before topics is set to an empty array
  • Loading branch information
McNaBry committed Oct 20, 2024
1 parent fd75363 commit 899d47c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/app/matching/matching.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class MatchingComponent implements OnInit {
this.fetchTopics();
this.matchForm = new FormGroup(
{
topics: new FormControl([], [Validators.minLength(1)]),
topics: new FormControl([], [Validators.required, Validators.minLength(1)]),
difficulty: new FormControl<Difficulty | null>(null, [Validators.required]),
},
{
Expand Down

0 comments on commit 899d47c

Please sign in to comment.