Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style source reload error on browser tab change #2926

twelch opened this issue Aug 2, 2016 · 1 comment

Style source reload error on browser tab change #2926

twelch opened this issue Aug 2, 2016 · 1 comment


Copy link

twelch commented Aug 2, 2016

Observed with version 0.21.0 or latest master

I have a web socket streaming in events multiple per second. Each event is added to the map as a point icon for 2 seconds using its own source and layer. All is good until I change browser tabs, then I observe that the map stops re-rendering (to be efficient I assume) and the style update queue starts filling. When I switch back to the map tab, the style update resumes and batch processes the queue (with all of the source adds/removes), and I get a source reload error.

I didn't have this error with version 0.15.0, prior to the refactoring of batch processing.


Try out,console,output

You should see contour sources and layers getting added and removed in quick succession. Now change tabs for at least a few seconds and then change back. Observe the console error Cannot read property 'reload' of undefined. After that the map is in a broken state and you'll need to refresh.

From what I've observed the error is due to the Style trying to reload one of the short-lived sources from Style.update, after its been removed.

I think what's happening is that the Style object isn't deleting source id's from it's internal _updates.sources list when Style.removeSource is called as is done for _updates.layers

The fix

Pull request forthcoming that I think resolves the issue. Comments welcome, thanks.

Copy link

mourner commented Aug 2, 2016

Thanks! The fix looks right, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants