Front-end Table Script Error
I have a front-end script that's filtering some JSON objects, displaying only a few key properties, using a
map()
call. The script works fine, but I'm getting an error every time it executes.7 Replies
The error is that bg_0.result is undefined
But it's not undefined ... it's working properly
My items are populated in the result
Oh wait ... maybe it's undefined initially, but after
bg_0
completes, it calls it againCould you share a minimal reproduction of your app please
Yup ... this is what was happening. I wrapped the result in an
if
statement.
you can also add ? in a few places
bg_0.result?.map .... ?? []