mikebronner / nova-map-marker-field

Provides an visual interface for editing latitude and longitude coordinates.
MIT License
131 stars 36 forks source link

Google search provider does not work #50

Open schrink opened 3 years ago

schrink commented 3 years ago

Describe the bug When I set Google as a provider, it does not change. API key is good and working in the other parts of applicaiton

To Reproduce Steps to reproduce the behavior:

            MapMarker::make("Location")
                ->defaultZoom(18)
                ->searchProvider('google')
                ->searchProviderKey(env('GOOGLE_MAPS_GEOCODING_API_KEY')),

Expected behavior It should use Google Geocoding API.

Screenshots DevTools_-_ourbeloved_cy_admin_resources_churches_604_edit_and_New_Issue_·_GeneaLabs_nova-map-marker-field

Environment:

iSaadSalman commented 3 years ago

Issue seem to be here in line # 71 on FormField: Previously:
` const providerOptions = {};

        if (typeof this.field.searchProviderKey !== 'undefined') {
            providerOptions.params.key = this.field.searchProviderKey;
        }`

I changed it to:

const providerOptions = {params: {key: null}};

But there are other issues are there after this. This happens after clicking the suggestion second time:

nova-map-marker-field:28379 Uncaught (in promise) TypeError: Cannot create property '_leaflet_id' on string '85' at stamp (nova-map-marker-field:28379) at NewClass.getLayerId (nova-map-marker-field:35194) at NewClass.hasLayer (nova-map-marker-field:35120) at NewClass.removeLayer (nova-map-marker-field:35244) at NewClass.showResult (nova-map-marker-field:27414) at NewClass.<anonymous> (nova-map-marker-field:27401) at eval (eval at processIncludes (nova-map-marker-field:1), <anonymous>:3:4725)

nilsE commented 3 years ago

...same here: "Cannot create property '_leaflet_id' on string '85' at stamp"... the first time you select an address it works, then this js error appears, no matter which search provider is used.