-
Notifications
You must be signed in to change notification settings - Fork 69
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
Replace deleteExercise with removeExercise resolver in the client #2668
Changes from 11 commits
2cb3744
01b1279
1dd05ce
ad8bb88
5a52746
3cc4a58
144384a
53501b3
cb6f83f
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 |
---|---|---|
|
@@ -193,7 +193,9 @@ const ExercisesPage = ({ lessonSlug }: ExercisesProps) => { | |
const mapExercisesToExerciseCard = data?.exercises | ||
.filter( | ||
exercise => | ||
exercise.flaggedAt && exercise.module.lesson.slug === lessonSlug | ||
exercise.flaggedAt && | ||
!exercise.removedAt && | ||
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. I added a condition to prevent the display of any removed exercises. Sending removed exercises to the client would be a waste of bandwidth, as they will not be displayed. Instead, it would be more efficient to have the backend filter out removed exercises and only send the ones that should be displayed to the client. 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. Not only is it more efficient, it is the correct way. If the user is not supposed to see some data/be able to access it/perform some action, merely hiding it on the frontend is never enough, it should not be available at the client in the first place and backend should ensure that. |
||
exercise.module.lesson.slug === lessonSlug | ||
) | ||
.map(exercise => { | ||
return ( | ||
|
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.
For this component, I noticed there's no error handling if the exercise wasn't removed/unflagged successfully.