The items of the datasource will switch from having Status Unavailable to Available, triggering a rerender of the widget. I guess the error is thrown on the first render when the items are not yet having the proper status. Can’t you add some if statements to check whether the items exist etc? Another option could be to only render if the datasource items have status ‘Available’
I have implemented such behavior in for instance my Google Maps Custom Marker (React) widget available in the Marketplace.
I was able to get the widget working thanks to Ivo Sturm’s insights. The updated and annotated code is below in case someone else runs into the same issues.