Closed
Description
openedon Aug 15, 2023
Description
Sometimes a request for related media returns undefined
in the results
. This causes an error when we try to map decodeMediaData
over the results
array:
openverse/frontend/src/data/media-service.ts
Lines 102 to 104 in 1673c0e
A simple solution could be to add ?? []
to the results. This will replace the undefined
value in results with an empty array, which can be used in the map
here:
results: (res.data.results ?? []).map((item) =>
Sentry issue
TypeError: Cannot read properties of undefined (reading 'map')
at key (./src/data/media-service.ts:102:33)
at Generator.next (<anonymous>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done