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

"ArcGIS API failed to load" Due to map_2.load(). otherwise is not a function #180

Closed prudhvi-rajkumar closed 4 years ago

prudhvi-rajkumar commented 4 years ago

This issue is happening in this code block:

map_2.load().then(function () {
                    return map_2.basemap.load();
                })
                    .then(function () {
                    var allLayers = map_2.allLayers;
                    var promises = allLayers.map(function (layer) { return layer.load(); });
                    return all(promises.toArray());
                })
                    .then(function () {
                    var view = new ViewConstructor(__assign({ container: containerId, map: map_2 }, props.viewProperties));
                    Object.keys(eventMap).forEach(function (key) {
                        if (props[key]) {
                            view.on(eventMap[key], props[key]);
                        }
                    });
                    resolve({ map: map_2, view: view });
                }).otherwise(function (err) {
                    reject(err);
                });

The last block of otherwise is causing the error, as it is not catching the promise to reject it back. I have found that in your pull request, but not moved to the release. Could you help us in using the WebScene?

gavinr commented 4 years ago

@prudhvi-rajkumar which pull request are you referring to?

prudhvi-rajkumar commented 4 years ago

Oh sorry, not pull request, on 13th April commit with dda944664787af96e0ab528b098382f1b5e2fa0c, made the file changes from .otherwise() to .catch(), but didn't rolled out to the release. This results in ArcGIS API failed to load the message I'm getting when I'm using Web scene.

prudhvi-rajkumar commented 4 years ago

May I get any help on this?

sevenninety commented 4 years ago

I've noticed the same thing and as you say it's the 'otherwise' that causes the issue. My temporary fix is to modify ArcComposites.js in node_modules and change 'otherwise' to 'catch'. That stops the error for me and my app is able to load.

gavinr commented 4 years ago

@sevenninety @prudhvi-rajkumar The otherwise vs catch changes from #178 were released in v5.1.0 - please test and let us know if there are any issues. Thanks!

kkarkos commented 4 years ago

This is still happening with WebScene. No issues with Scene.

Also reported here: https://github.com/Esri/react-arcgis/issues/54

gavinr commented 4 years ago

@kkarkos thanks for the report. I'm not totally sure this is the same issue (Even though same error message). Could be the same, just not sure - could you please open a new issue with a reproducible test case on the latest release so we can look into it? Thanks!