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

SearchBox undefined #39

Open
PolGuixe opened this issue Nov 26, 2015 · 2 comments
Open

SearchBox undefined #39

PolGuixe opened this issue Nov 26, 2015 · 2 comments

Comments

@PolGuixe
Copy link

I am getting this error:
Exception from Tracker afterFlush function: debug.js:41 TypeError: Cannot read property 'SearchBox' of undefined at initTemplateAndGoogleMaps (autoform-map.coffee:82) at null.<anonymous> (autoform-map.coffee:112) at view.js:199 at Function.Template._withTemplateInstanceFunc (template.js:457) at view.js:197 at Object.Blaze._withCurrentView (view.js:538) at viewAutorun (view.js:196) at Tracker.Computation._compute (tracker.js:323) at new Tracker.Computation (tracker.js:211) at Object.Tracker.autorun (tracker.js:562)
The map displays fine, but the search box does not appear.

However if I reload the page that contains this template then there is no problem. So the problem only appears when I get to the page from another page on the own site.

@PolGuixe
Copy link
Author

PolGuixe commented Dec 4, 2015

Situatution:
I am using dburles:googl-maps so display different maps on my app.
I am also using yogiben:autoform-map to let user input their location in a form.

Problem:
I was calling GoogleMaps.load() every time a map template was rendered with onRendered. Somehow this was preventing the GoogleMaps.load({libraries:'places'}) inside yogiben:autoform-map to load the library properly.

Solution:
I removed the GoogleMaps.load() from the map templates and placed it in:

Meteor.startup(function() {
    GoogleMaps.load({
        libraries: 'places'
    });
});

This way I ensure that the libraries that I need are included.

Can anyone think of a better solution?

@MichalW
Copy link

MichalW commented Mar 19, 2016

+1

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

No branches or pull requests

2 participants