Matt-Jensen / ember-cli-g-maps

Deprecated Google Maps Addon

Home Page:http://matt-jensen.github.io/ember-cli-g-maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gmaps-for-apps bower dependency introduces error with upgrade to ember 2.11

thedig opened this issue · comments

Hi there,

I see there is the intention to move off this bower dependency, per issue: #66

In the meanwhile upgrading to ember 2.11 is now generating an error when attempting to add a marker to a map that is associated with the bower dependency. I'm posting here instead of in the bower package b/c issue #66 gives me the impression this might cease to be supported?

gmaps.js:

  if(options.hasOwnProperty('gm_accessors_')) {
    // Native google.maps.Marker object
    marker = options;
  }

Trace:

Uncaught TypeError: options.hasOwnProperty is not a function
    at GMaps.addMarker (gmaps.js:1172)
    at Class.sync [as _gmapMarkerSync] (child-collection.js:65)
    at Object.applyStr (ember.debug.js:39713)
    at Object.sendEvent (ember.debug.js:17885)
    at notifyObservers (ember.debug.js:21858)
    at Object.propertyDidChange (ember.debug.js:21667)
    at Object.set (ember.debug.js:22072)
    at Class.set (ember.debug.js:34722)
    at Class._onMapLoad (main.js:150)
    at Backburner.run (ember.debug.js:717)

@thedig thanks for publishing this issue. I however cannot reproduce this issue. Can you show me how you declare your marker and g-map?

Sure. We yield it in two parts in the component:

{{#let (hash
         lat=lat
         lng=lng
         infoWindow=(hash content=name)
         visible=true
       )
   as |marker|
}}
  {{yield (hash
    location-autocomplete=(component "g-autocomplete"
      value=site.autocomplete
      on-select=(action 'didUpdatePlace')
      disabled=disabled
    )

    map-component=(component "g-maps"
      mapType="hybrid"
      disableDefaultUI=true
      showScaleControl=false
      showZoomControl=true
      draggable=false
      scrollwheel=false
      name=name
      lat=lat
      lng=lng
      zoom=15
      markers=(array marker)
    )
  )}}
{{/let}}

For the record I attempted on a parallel repo to upgrade to 2.10.1 for comparison. Getting the exact same error this case. (this is an upgrade from a 2.8 lts app which had marker functionality working). I've also verified that the array helper is returning an ember array.

@thedig I'm assuming your using ember-composable-helpers helpers for the array helper and ember-let for the let helper? It's really hard to know what data your passing around when I don't know what your helpers are doing.

update - this appears to be a breaking change from upgrading to ^2.10.0 / Glimmer2 (not a bug) - emberjs/ember.js#14489

By design, Ember's hash helper now returns an EmptyObject instead of an Object which lacking the prototype, has no call to hasOwnProperty available

I'll be creating a work-around for now to pass in a regular POJO and awaiting if/when there's an update that accounts for the change.