React-leaflet: createLeafletElement

Created on 19 Jan 2017  路  4Comments  路  Source: PaulLeCam/react-leaflet

This new functionality breaks compatibility with react-leaflet-heatmap-layer

Most helpful comment

@jetaix See code excerpt:

// React-Leaflet addition
// See https://github.com/PaulLeCam/react-leaflet/blob/master/src%2FImageOverlay.js
//
// Given a Hyrax endpoint URL, this layer adds an ImageOverlay layer on Leaflet
// and refreshes its image content based on the Hyrax service endpoint.
// Unlike WMS services, images are constructed client-side, and it offers
// flexibility of changing colour maps and thresholds without re-querying the
// server.
export default class HyraxMapLayer extends MapLayer {

  // See https://github.com/PaulLeCam/react-leaflet/issues/275
  createLeafletElement () {}

All 4 comments

Why throw an error where as before it was fine?

The issue is that MayLayer.js now has

  // eslint-disable-next-line no-unused-vars
  MapLayer.prototype.createLeafletElement = function createLeafletElement(props) {
    throw new Error('createLeafletElement() must be implemented');
  };

Which means any classes subclassing subsequently is now forced to implement a possibly empty function just so it works again.

Edit: I added createLeafletElement () {} in my subclass and it works again.

I am not the author of react-leaflet-heatmap-layer, so this is something you should report in the relevant bug tracker, not here.
The added createLeafletElement() does not break any public API, but requires changes if you are using internal ones, as documented in the upgrade guide.

@Spaxe What do you mean by in my subclass ?

@jetaix See code excerpt:

// React-Leaflet addition
// See https://github.com/PaulLeCam/react-leaflet/blob/master/src%2FImageOverlay.js
//
// Given a Hyrax endpoint URL, this layer adds an ImageOverlay layer on Leaflet
// and refreshes its image content based on the Hyrax service endpoint.
// Unlike WMS services, images are constructed client-side, and it offers
// flexibility of changing colour maps and thresholds without re-querying the
// server.
export default class HyraxMapLayer extends MapLayer {

  // See https://github.com/PaulLeCam/react-leaflet/issues/275
  createLeafletElement () {}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

treydavis picture treydavis  路  4Comments

farahabdi picture farahabdi  路  3Comments

benzen picture benzen  路  4Comments

kojoa picture kojoa  路  3Comments

rolfdalhaug picture rolfdalhaug  路  3Comments