Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Fix map tile issue #217

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open

Conversation

bschoenfeld
Copy link
Member

Map tiles aren't loading the first time you open the map view on any stop on the home page. Through playing around in the console, I discovered that showing the mapcanvas at different times, or even just pausing execution with a break point seems to fix the problem. I suppose it's an issue with timing of the DOM rendering. This isn't an elegant solution, but it seems to fix the issue. Open to better ideas.

@qwo
Copy link
Member

qwo commented Aug 28, 2018

setTimeout(func, 250) lgtm

@kmcurry
Copy link
Member

kmcurry commented Aug 29, 2018

Is async defer appropriate?

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=BLRRRRRRGGGHHH&callback=initialize" **async defer**></script>

@kmcurry
Copy link
Member

kmcurry commented Aug 29, 2018

And did you try waiting inside $( document ).ready()

@bschoenfeld
Copy link
Member Author

I'd be surprised if it's a problem with the document being ready, scripts loaded in, etc because we don't try to show the map on page load. You can wait as long as you'd like before clicking the button to show the map and you'll still experience the problem.

What happens when you click the button to see the map is we generate a view with a google map in it, shove it into a div tag and invoke the resize command. So it feels like a timing thing where the view isn't actually rendered quite right when the resize is invoked, causing google maps to think it doesn't need to render the tiles.

But I can't really figure it out... and it was all working for a while and then it broke without us changing anything, so I guess maybe something changed in the google maps js?

@ryayak1460
Copy link

Google Maps JS change sounds like the likely culprit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants