VulcanJS / vulcan-places

Google Maps Places integration for Vulcan
6 stars 3 forks source link

Headtags.script Not Defined #1

Open FaeezBorman opened 6 years ago

FaeezBorman commented 6 years ago

Hi Guys

Still getting my feet wet with vulcan, today I tried to use this package

TypeError: Cannot read property 'script' of undefined at meteorInstall.node_modules.meteor.vulcan:places.lib.modules.headtags.js (packages/vulcan:places/lib/modules/headtags.js:7:7)

I am on vulcan/core 1.7.0, I have not used headtags anywhere yet

wondering if i need to include somewhere in the server start up

Thanks in advise

SachaG commented 6 years ago

Can you try updating to the latest Vulcan (1.8.7 currently) first?

FaeezBorman commented 6 years ago

Sure, let me try that

FaeezBorman commented 6 years ago

@SachaG I have tried with Vulcan 1.8.9 latest

I am having a similar problem

Initially with PlaceControl.jsx:71:25

PlaceControl.propTypes = { name: React.PropTypes.string, value: React.PropTypes.any, label: React.PropTypes.string };

TypeError: Cannot read property 'string' of undefined

I changed my local version to import PropTypes directly, React no longer ships with it

import PropTypes from 'prop-types'

PlaceControl.propTypes = { name: PropTypes.string, value: PropTypes.any, label: PropTypes.string };

Now I get the same error as before on went this executes

Headtags.script.push({ type: 'text/javascript', src: https://maps.googleapis.com/maps/api/js?key=${googlemaps.apiKey}&libraries=places });

TypeError: Cannot read property 'script' of undefined

Let me know what other details you require.

I will say that I have been working on this project of mine on-off for some time. I may be missing some crucial changes required since multiple upgrades to vulcan core have taken place throughout that time

FaeezBorman commented 6 years ago

I found something

Looks like a typo, the import should be

import { HeadTags, getSetting } from 'meteor/vulcan:core';

however, script is undefined

on my local copy i just added

HeadTags.script = []

calinn commented 6 years ago

You must change 'HeadTag' name. 'Head' instead of 'HeadTag' import { Head } from 'meteor/vulcan:core'; Head.script.push();

https://github.com/VulcanJS/Vulcan/blob/0c06dc9b55e6bb456124f38f881aebad917c8025/packages/vulcan-core/lib/modules/components/HeadTags.jsx

lc3t35 commented 6 years ago

you have also to migrate

<PlacesAutocomplete inputProps={inputProps} onSelect={this.onSelect} />

with last version of https://github.com/kenny-hibino/react-places-autocomplete/wiki/Migration-Guide-(From-v6.x-to-v7.x)