diff --git a/.eslintrc b/.eslintrc index d1835e86..2b81a3a7 100644 --- a/.eslintrc +++ b/.eslintrc @@ -67,6 +67,7 @@ "no-unused-vars": 2, "no-use-before-define": 1, "quotes": [2, "single", "avoid-escape"], + "jsx-quotes": [1, "prefer-single"], "constructor-super": 2, "no-class-assign": 2, "no-const-assign": 2, @@ -79,7 +80,6 @@ "react/jsx-max-props-per-line": 0, "react/jsx-no-duplicate-props": 2, "react/jsx-no-undef": 2, - "react/jsx-quotes": 1, "react/jsx-sort-prop-types": 1, "react/jsx-sort-props": 1, "react/jsx-uses-react": 1, diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c6d9bc2..4cb5a36e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.8.0-rc.2 (22/09/15) + +Check if `Popup` content node exists before trying to unmount. + ## v0.8.0-rc.1 (16/09/15) - Updated React to v0.14.0-rc1. diff --git a/README.md b/README.md index 4600561c..4fadce78 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ L.marker(position).addTo(map) **React-Leaflet** ```js import React from 'react'; +import { render } from 'react-dom'; import { Map, Marker, Popup, TileLayer } from 'react-leaflet'; const position = [51.505, -0.09]; @@ -53,7 +54,7 @@ const map = ( ); -React.render(map, document.getElementById('map-container')); +render(map, document.getElementById('map-container')); ``` Note that the `` component creates its own `
` container for the map, it does not get attached to an existing node. diff --git a/example/build/lib.js b/example/build/lib.js index fa1de4fc..323ba73f 100755 --- a/example/build/lib.js +++ b/example/build/lib.js @@ -1374,7 +1374,9 @@ var Popup = (function (_MapComponent) { }, { key: 'removePopupContent', value: function removePopupContent() { - (0, _reactDom.unmountComponentAtNode)(this.leafletElement._contentNode); + if (this.leafletElement._contentNode) { + (0, _reactDom.unmountComponentAtNode)(this.leafletElement._contentNode); + } } }, { key: 'render', diff --git a/lib/Popup.js b/lib/Popup.js index eede7915..4da555de 100644 --- a/lib/Popup.js +++ b/lib/Popup.js @@ -110,7 +110,9 @@ var Popup = (function (_MapComponent) { }, { key: 'removePopupContent', value: function removePopupContent() { - (0, _reactDom.unmountComponentAtNode)(this.leafletElement._contentNode); + if (this.leafletElement._contentNode) { + (0, _reactDom.unmountComponentAtNode)(this.leafletElement._contentNode); + } } }, { key: 'render', diff --git a/package.json b/package.json index 11ba1a1b..780ae077 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-leaflet", - "version": "0.8.0-rc.1", + "version": "0.8.0-rc.2", "description": "React components for Leaflet maps", "main": "lib/index.js", "scripts": { @@ -43,16 +43,16 @@ }, "devDependencies": { "babel": "^5.8.23", - "babel-eslint": "^4.1.2", + "babel-eslint": "^4.1.3", "babelify": "^6.3.0", "browserify": "^11.0.1", - "eslint": "^1.4.3", - "eslint-plugin-react": "^3.3.1", + "eslint": "^1.5.0", + "eslint-plugin-react": "^3.4.2", "gulp": "^3.9.0", "gulp-load-plugins": "^0.10.0", "gulp-util": "^3.0.6", "gulp-webserver": "^0.9.1", - "jest-cli": "^0.5.5", + "jest-cli": "^0.5.7", "leaflet": "^0.7.5", "onchange": "^2.0.0", "react": "^0.14.0-rc1", diff --git a/src/Popup.js b/src/Popup.js index eb620255..384e4a8d 100644 --- a/src/Popup.js +++ b/src/Popup.js @@ -74,7 +74,9 @@ export default class Popup extends MapComponent { } removePopupContent() { - unmountComponentAtNode(this.leafletElement._contentNode); + if (this.leafletElement._contentNode) { + unmountComponentAtNode(this.leafletElement._contentNode); + } } render() {