Skip to content

google-map-marker content does not update in dom-repeat #263

@mchp

Description

@mchp

Create some google-map-marker with content (infowindow) via dom-repeat template bounded to a data array. When the bound data changes, the position of all the markers are updated, but the contents are not.

I think this is because dom-repeat efficiently reuses existing doms. When google-map calls _attachChildrenToMap, child.map could already be set to the current map. Since the value is not updated, google-map-marker's _mapChanged and indirectly _contentChanged method is never called.

The MutationObserver attached in _contentChanged is also never fired because of this.

Example

      <template is="dom-repeat" items="[[data]]">
        <google-map-marker latitude="[[item.latitude]]" longitude="[[item.longitude]]">
          [[item.details]]
        </google-map-marker>
    </google-map>
  Polymer({
    properties: {
       data: {
         type: Array,
         value: [{
           latitude: 10.0,
           longitude: 10.0,
           details: "OLD VALUE",
         }]
       }
    },
    ready: function() {
      this.data = [{
        latitude: 20.0,
        longitude: 20.0,
        details: "CURRENT VALUE"
      }];
    }
  })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions