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

Fix an issue with Chrome and hidden tabs. #1042

Merged
merged 1 commit into from
Oct 28, 2019

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Oct 25, 2019

When the webpage is on a hidden tab, tiles are not rendered. This seems to only be a problem with Chrome. This adds 'hidden' and 'unhidden' events, so any feature can hook into these.

The webgl tile layer refreshes its tile cache when unhidden.

@manthey
Copy link
Contributor Author

manthey commented Oct 25, 2019

This doesn't have automatic test coverage; we'd have to add quite a bit of code to have Chrome with multiple tabs and code coverage.

You can test this manually -- on master, load the tile example. One a developer console as a separate window. Switch to another tab. In the developer console, hit reload. Wait ~10 seconds for the hidden tab to finish loading tiles. When you switch back to the tab with the tile example, the map will be blank.

It is a bit tougher to show off the corrected code without building locally -- the tutorial can't be used since it gets refreshed properly after being hidden since it is in an iframe.

This is a problem seen in actual deployments -- open a tab and switch away before the map finishes loading; switching back and those tiles that were loaded while hidden will be blank.

@manthey manthey force-pushed the refresh-tiles-when-unhidden branch 2 times, most recently from bdb20c2 to f4271bf Compare October 25, 2019 14:00
When the webpage is on a hidden tab, tiles are not rendered.  This seems
to only be a problem with Chrome.  This adds 'hidden' and 'unhidden'
events, so any feature can hook into these.

The webgl tile layer refreshes its tile cache when unhidden.
@manthey manthey merged commit ab109b4 into master Oct 28, 2019
@manthey manthey deleted the refresh-tiles-when-unhidden branch October 28, 2019 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants