AnsweredAssumed Answered

Directions widget crash on reset() or removeStops()

Question asked by rbueno_psl on Aug 24, 2017
Latest reply on Aug 30, 2017 by dkudinov-esristaff

I've ran into an issue when managing stops through javascript, where removing all stops by either using reset() or removeStops results in an error that renders the widget unusable and leaves orphaned layers on the map:


here's the codepen with an array of stops to try it: 


As the screenshot shows, you can add the stops with 'dirs.addStops(stops)' and after it calculates the route, try removing all stops with 'dirs.removeStops()' or 'dirs.reset()'.

the error doesn't always happen on the first try.


Things I've tried:

- Add the stops as Points

- Add the stops as all Stops (no waypoints)

- Add the stops as Graphics

- Add the stops as an object with a graphic feature

- Add all stops, then all waypoints


Any pointers on how to solve this or work around it? 


Thanks in advance.