Bug Report
Unguarded property access can white-screen the whole mentors page and the landing page when a record omits optional fields (the backend serializes with JsonInclude.NON_NULL, so absent fields arrive as missing keys).
src/components/MentorProfileCard.tsx — line 98 mentor.images[0]?.path (throws if images itself is absent), line 187 mentor.country.countryName, line 190 mentor.network.map(...), line 226 mentor.skills.yearsExperience (line 114 defensively uses skills?. but 226 doesn't), line 230 mentor.spokenLanguages.length, line 271 mentor.menteeSection.additional.
src/components/EventContainer.tsx:65 event.endDate.split(', '), line 71 event.speakerProfile.label; src/components/EventCard.tsx:67,77 images[0].path. Backend Event.speakerProfile is nullable.
Reproduction
- A mentor record with a null
network/images/country → one bad mentor throws during render → the entire /mentorship/mentors list white-screens.
- A CMS event with no speaker/images/endDate → the home page throws during render (SSR 500 / client crash).
Severity
Medium
Potential Risk
- A single sparse record takes down an entire public page.
Suggested Fix
- Guard all optional-field access with optional chaining / defaults, consistently (e.g.
mentor.images?.[0]?.path, mentor.network?.map, event.speakerProfile?.label).
- Consider normalizing API responses (default missing arrays to
[]) at the fetch boundary.
- Add tests rendering mentor/event cards from minimal payloads.
Registration-side complement to #271 (rendering existing images); this covers crashes on sparse data across cards.
Bug Report
Unguarded property access can white-screen the whole mentors page and the landing page when a record omits optional fields (the backend serializes with
JsonInclude.NON_NULL, so absent fields arrive as missing keys).src/components/MentorProfileCard.tsx— line 98mentor.images[0]?.path(throws ifimagesitself is absent), line 187mentor.country.countryName, line 190mentor.network.map(...), line 226mentor.skills.yearsExperience(line 114 defensively usesskills?.but 226 doesn't), line 230mentor.spokenLanguages.length, line 271mentor.menteeSection.additional.src/components/EventContainer.tsx:65event.endDate.split(', '), line 71event.speakerProfile.label;src/components/EventCard.tsx:67,77images[0].path. BackendEvent.speakerProfileis nullable.Reproduction
network/images/country→ one bad mentor throws during render → the entire/mentorship/mentorslist white-screens.Severity
Medium
Potential Risk
Suggested Fix
mentor.images?.[0]?.path,mentor.network?.map,event.speakerProfile?.label).[]) at the fetch boundary.Registration-side complement to #271 (rendering existing images); this covers crashes on sparse data across cards.