mapbox-gl-directions icon indicating copy to clipboard operation
mapbox-gl-directions copied to clipboard

Fix bug where re-adding component on style change fails

Open jonathonwpowell opened this issue 5 years ago • 1 comments

The goal of this PR is to fix #190

Currently if a user of Mapbox GL JS is using this component and they want to switch styles, they need to remove and re-add the directions component. But due to how the onAdd function works, it will not trigger the re-addition of some styles, as it will wait for a load event that will never come. Instead this subscribes to the idle event and then unsubscribes itself once it has triggered.

Please let me know if I can improve the PR in any way :)

jonathonwpowell avatar Jan 11 '20 22:01 jonathonwpowell

Any updates on this fix?

xiaofanliang avatar Jun 12 '23 21:06 xiaofanliang