echarts-for-react 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/core.js CHANGED
@@ -51,6 +51,7 @@ var EchartsReactCore = function (_Component) {
51
51
  try {
52
52
  _elementResizeEvent2['default'].unbind(_this.echartsElement);
53
53
  } catch (_) {}
54
+ // dispose echarts instance
54
55
  _this.echartsLib.dispose(_this.echartsElement);
55
56
  }
56
57
  };
@@ -130,13 +131,12 @@ var EchartsReactCore = function (_Component) {
130
131
  key: 'componentDidUpdate',
131
132
  value: function componentDidUpdate(prevProps) {
132
133
  var echartObj = this.renderEchartDom();
133
- this.bindEvents(echartObj, this.props.onEvents || {});
134
134
 
135
135
  // 以下属性修改的时候,需要 dispose 之后再新建
136
136
  // 1. 切换 theme 的时候
137
137
  // 2. 修改 opts 的时候
138
138
  // 3. 修改 onEvents 的时候,这样可以取消所以之前绑定的事件 issue #151
139
- if (prevProps.theme !== this.props.theme || !isEqual(prevProps.opts, this.props.opts) || !isEqual(Object.keys(prevProps.onEvents).sort(), Object.keys(this.props.onEvents).sort())) {
139
+ if (prevProps.theme !== this.props.theme || !isEqual(prevProps.opts, this.props.opts) || !isEqual(Object.keys(prevProps.onEvents || {}).sort(), Object.keys(this.props.onEvents || {}).sort())) {
140
140
  this.dispose();
141
141
 
142
142
  this.rerender(); // 重建
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echarts-for-react",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "baidu Echarts(v3.x & v4.x) components for react.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/core.jsx CHANGED
@@ -19,7 +19,6 @@ export default class EchartsReactCore extends Component {
19
19
  // update
20
20
  componentDidUpdate(prevProps) {
21
21
  const echartObj = this.renderEchartDom();
22
- this.bindEvents(echartObj, this.props.onEvents || {});
23
22
 
24
23
  // 以下属性修改的时候,需要 dispose 之后再新建
25
24
  // 1. 切换 theme 的时候
@@ -28,7 +27,7 @@ export default class EchartsReactCore extends Component {
28
27
  if (
29
28
  prevProps.theme !== this.props.theme ||
30
29
  !isEqual(prevProps.opts, this.props.opts) ||
31
- !isEqual(Object.keys(prevProps.onEvents).sort(), Object.keys(this.props.onEvents).sort())
30
+ !isEqual(Object.keys(prevProps.onEvents || {}).sort(), Object.keys(this.props.onEvents || {}).sort())
32
31
  ) {
33
32
  this.dispose();
34
33
 
@@ -60,6 +59,7 @@ export default class EchartsReactCore extends Component {
60
59
  try {
61
60
  elementResizeEvent.unbind(this.echartsElement);
62
61
  } catch (_) {}
62
+ // dispose echarts instance
63
63
  this.echartsLib.dispose(this.echartsElement);
64
64
  }
65
65
  };