Inoc 2 + MapBox directions = polyfills.js exception

Hi,

I’m trying to integrate MapBox inside my ionic 2 app, and everything is working fine until I start typing for directions.
I can see that it does a lot of background calls (http) the first few as i’m typing an address works until it some how gets overloaded and crashes with error “Error: More tasks executed then were scheduled.”

The “ngZone.run()” is just me trying random stuff to get it to work. But here is the code.

image

Help needed :slight_smile:

How are you integrating MapBox? (link to plugin/sdk/whatever)
What does your environment look like? (Output of ionic info please)

Ionic info:
Your system information:

ordova CLI: 6.4.0
Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.6.0
Xcode version: Not installed

I’m using the js version of mapbox: https://api.mapbox.com/mapbox-gl-js/v0.35.1/mapbox-gl.js in my index file as script tag.

But I don’t think this issue has anything to do with mapbox, the way I see it the issue is that if you have some sort of autocompete logic, that makes request every time you type, it either get too many request or that if some request gets cancelled it crashes.

I’ve found a workaround that if I comment this out from the polyfills.js everything works fine : “if(o<0)/throw new Error(“More tasks executed then were scheduled.”)/”

Take a look at the cancelled request I think they are the issue, the polyfills can’t handle that I guess.