mirror of
https://github.com/maputnik/editor.git
synced 2025-12-26 08:00:01 +00:00
Remove Immutable JS
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
import React from 'react'
|
||||
import Immutable from 'immutable'
|
||||
|
||||
export default class Map extends React.Component {
|
||||
static propTypes = {
|
||||
mapStyle: React.PropTypes.instanceOf(Immutable.Map).isRequired,
|
||||
mapStyle: React.PropTypes.object.isRequired,
|
||||
accessToken: React.PropTypes.string,
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
//TODO: If we enable this React mixin for immutable comparison we can remove this?
|
||||
return nextProps.mapStyle !== this.props.mapStyle
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div
|
||||
ref={x => this.container = x}
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class MapboxGlMap extends Map {
|
||||
|
||||
//Mapbox GL now does diffing natively so we don't need to calculate
|
||||
//the necessary operations ourselves!
|
||||
this.state.map.setStyle(style.toJSON(nextProps.mapStyle), { diff: true})
|
||||
this.state.map.setStyle(nextProps.mapStyle, { diff: true})
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -31,7 +31,7 @@ export default class MapboxGlMap extends Map {
|
||||
|
||||
const map = new MapboxGl.Map({
|
||||
container: this.container,
|
||||
style: style.toJSON(this.props.mapStyle),
|
||||
style: this.props.mapStyle,
|
||||
});
|
||||
|
||||
map.on("style.load", (...args) => {
|
||||
|
||||
Reference in New Issue
Block a user