Esri / react-arcgis

A few components to help you get started using the ArcGIS API for JavaScript and esri-loader with React
Apache License 2.0
319 stars 79 forks source link

Any error in the webmap shows "The ArcGIS API failed to load" #199

Closed slead closed 2 years ago

slead commented 3 years ago

I've created a WebMap which has a deliberate error - a layer is missing. Using the standard ArcGIS JS API approach, this is handled unobtrusively, with the WebMap loading without the broken layer:

Screen Shot 2020-12-11 at 2 06 30 pm

By contrast, the react-arcgis library throws a fatal error and returns "the ArcGIS API failed to load" when it encounters the same webmap:

https://codesandbox.io/s/load-failed-webmap-1jf3u?file=/src/index.js

Screen Shot 2020-12-11 at 2 08 37 pm

Expected behavior Rather than failing with a fatal error, the react-arcgis WebMap should just ignore the broken layer, as in the core JS API behaviour.

To Reproduce

See the simple demo at https://codesandbox.io/s/load-failed-webmap-1jf3u?file=/src/index.js and compare with the non-React version at https://codepen.io/slead/pen/bGwBRVw

Additional context As a workaround, I used the esri-loader approach without react-arcgis and was able to avoid this issue.

tomwayson commented 2 years ago

Good point @slead - people should just use @arcgis/core or esri-loader directly in their React apps.

Closing as we are archiving this repo.