BloomTech-Labs/family-promise-service-tracker-fe-a

App crashes when logged in user is not assigned to any programs

Closed this issue · 0 comments

The profile render component is trying to map over a programs array which will be null for some users, such as service providers or for new users who haven't yet been assigned to any programs. Need to handle the null case.

How to recreate:

TypeError: Cannot read property 'name' of null
(anonymous function)
src/components/pages/MyProfile/RenderMyProfile.js:90
  87 | <div>
  88 |   {curUser.programs.map(program => (
  89 |     <>
> 90 |       <h4>{program.name}</h4>
     | ^  91 |     </>
  92 |   ))}
  93 | </div>