Remove Immutable JS

This commit is contained in:
Lukas Martinelli
2016-12-20 16:08:49 +01:00
parent ed87425f01
commit 36c4032063
22 changed files with 100 additions and 199 deletions

View File

@@ -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}

View File

@@ -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) => {