[Google Places] It does not work when widget is not rendered in the first moment
Question
Forge component by Ouen Worth

Hi guys,


We intend to use the google places widget in a second tab (on lazy load) and we notice that when the widget is not there on the first place, which is the case, a JavaScript error is thrown "ReferenceError: google is not defined" when we switch for the second tab and the widget is finally rendered.

Any thoughts or ideas about this one?


Thanks in advance.

Cheers,

João Marques

mvp_badge
MVP

That error means that the Google Places components are not loaded when you try pushing data into them.

I would double check where the "Places" JavaScript is being loaded, I would make sure that it is either in the main page itself and you feed it the data to render on LazyLoad, or make sure that if you need the component in the lazy load area itself, that it appears before your data is pumped into it.

J.Ja

mvp_badge
MVP

Thanks Justin James,


I am aware of that, that's why I open this topic as a potential fix for a later version.


Greetings,

João Marques

João - thanks for the feedback on this scenario.

Looking through the implementation and the way that it needs the DOM available will cause you an issue.

Let me look into it further around creating a more robust implementation.

Ouen 

Hi Team,

I'm running into same issue. is there any update on fix ?

Thanks,

Prasanna.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.