HackGT / hackgt-org-website

HackGT's homepage with info about the organization and upcoming events
https://hack.gt/
MIT License
7 stars 7 forks source link

Large HackGT logo showing up on home screen sometimes #62

Closed kexin-zhang closed 6 years ago

kexin-zhang commented 6 years ago

screenshot 6

petschekr commented 6 years ago

This definitely still an issue on random loads (clearing cache, local storage, cookies seems to make it appear more often) and on first load in new browsers.

I've traced this to a bug (race condition) in the way the element is inserted into the page. It seems like the HackGT logo is being inserted twice. In the first instance, the #hackgt group is pulled out and moved somewhere else but this doesn't happen for the second logo so it appears in the top left corner.

screenshot 2

petschekr commented 6 years ago

Found the source (I think): https://github.com/HackGT/hackgt-org-website/blob/ce98688a84722d2196eda33bc493ab16a63bbd3b/js/home.js#L189

SVG file will be loaded if it doesn't exist on page load in the init() function. Then, after 100 ms timeout, resize() is called automatically calling init() again. If the SVG file hasn't loaded in 100 ms (happens if the cache is cleared and you have a slow network), it will be downloaded twice (or more).