Skip to content

Commit 044f4a1

Browse files
committed
Remove support for Immutable-js
1 parent d083093 commit 044f4a1

File tree

7 files changed

+2
-109
lines changed

7 files changed

+2
-109
lines changed

packages/react-jsx-highcharts/package-lock.json

Lines changed: 0 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-jsx-highcharts/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
"eslint-plugin-react-hooks": "^2.0.1",
7777
"eslint-plugin-react-perf": "^3.2.1",
7878
"highcharts": "^7.2.0",
79-
"immutable": "^4.0.0-0",
80-
"immutable3": "npm:immutable@^3.8.1",
8179
"jest": "^24.9.0",
8280
"jest-enzyme": "^7.1.1",
8381
"lodash-webpack-plugin": "^0.11.5",
@@ -91,8 +89,6 @@
9189
},
9290
"dependencies": {
9391
"@babel/runtime": "^7.5.5",
94-
"immutable-is": "^3.7.6",
95-
"is-immutable": "^1.0.1",
9692
"lodash-es": "^4.17.13",
9793
"uuid": "^3.3.3"
9894
},

packages/react-jsx-highcharts/src/components/Series/Series.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
33
import uuid from 'uuid/v4';
44
import { isEqual } from 'lodash-es';
55
import { attempt } from 'lodash-es';
6-
import isImmutable from 'is-immutable';
7-
import immutableEqual from 'immutable-is';
86
import SeriesContext from '../SeriesContext';
97
import { getNonEventHandlerProps, getEventsConfig } from '../../utils/events';
108
import getModifiedProps from '../../utils/getModifiedProps';
@@ -80,10 +78,7 @@ const Series = memo(({
8078

8179
let doRedraw = false;
8280
// Using setData is more performant than update
83-
if (isImmutable(data) && immutableEqual(data, prevProps.data) === false) {
84-
series.setData(data.toJS(), false);
85-
doRedraw = true;
86-
} else if (isEqual(data, prevProps.data) === false) {
81+
if (isEqual(data, prevProps.data) === false) {
8782
series.setData(data, false);
8883
doRedraw = true;
8984
}
@@ -127,13 +122,12 @@ const getSeriesConfig = (props, axis, requiresAxis) => {
127122
const { id, data, ...rest } = props;
128123

129124
const seriesId = typeof id === 'function' ? id() : id;
130-
const seriesData = isImmutable(data) ? data.toJS() : data;
131125
const nonEventProps = getNonEventHandlerProps(rest);
132126
const events = getEventsConfig(rest);
133127

134128
const config = {
135129
id: seriesId,
136-
data: seriesData,
130+
data,
137131
events,
138132
...nonEventProps
139133
};

packages/react-jsx-highcharts/test/components/Series/Series.spec.js

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import React from 'react';
2-
import { List as List4 } from 'immutable';
3-
import { List as List3 } from 'immutable3';
42
import { Highcharts, createMockProvidedChart, createMockProvidedAxis, createMockSeries, uuidRegex } from '../../test-utils';
53
import Series from '../../../src/components/Series/Series';
64
import HighchartsContext from '../../../src/components/HighchartsContext';
@@ -115,20 +113,6 @@ describe('<Series />', () => {
115113
}), false);
116114
});
117115

118-
[List3, List4].forEach((List) => {
119-
it('supports mounting with Immutable List data', () => {
120-
const data = [1, 2, 3, 4, 5];
121-
mount(
122-
<ProvidedSeries id="mySeries" data={List(data)} />
123-
);
124-
expect(testContext.chartStubs.addSeries).toHaveBeenCalledWith(expect.objectContaining(
125-
{ id: 'mySeries', yAxis: 'myAxis', type: 'line', data, visible: true }
126-
), false);
127-
// test immutable 3
128-
testContext.chartStubs.addSeries.mockClear();
129-
});
130-
});
131-
132116
it('throws Error when requiresAxis=true and mounted without axis', () => {
133117
testContext.propsFromProviders.axis = null;
134118

@@ -178,36 +162,6 @@ describe('<Series />', () => {
178162
expect(testContext.seriesStubs.setVisible).not.toHaveBeenCalled();
179163
expect(testContext.needsRedraw).not.toHaveBeenCalled();
180164
});
181-
[List3, List4].forEach((List) => {
182-
it('should use the setData method on the correct series when the Immutable List changes', () => {
183-
const wrapper = mount(
184-
<ProvidedSeries
185-
id="mySeries" data={List([1, 2, 3])} />
186-
);
187-
const newData = [1, 2, 3, 4, 5];
188-
testContext.seriesStubs.update.mockReset();
189-
wrapper.setProps({ data: List(newData) });
190-
expect(testContext.seriesStubs.setData).toHaveBeenCalledWith(newData, false);
191-
expect(testContext.seriesStubs.update).not.toHaveBeenCalled();
192-
expect(testContext.seriesStubs.setVisible).not.toHaveBeenCalled();
193-
});
194-
});
195-
[List3, List4].forEach((List) => {
196-
it('should NOT use the setData method if the Immutable List hasn\'t changed', () => {
197-
const wrapper = mount(
198-
<ProvidedSeries
199-
id="mySeries" data={List([1, 2, 3])} />
200-
);
201-
testContext.seriesStubs.update.mockReset();
202-
testContext.needsRedraw.mockClear();
203-
204-
wrapper.setProps({ data: List([1, 2, 3]) });
205-
expect(testContext.seriesStubs.setData).not.toHaveBeenCalled();
206-
expect(testContext.seriesStubs.update).not.toHaveBeenCalled();
207-
expect(testContext.seriesStubs.setVisible).not.toHaveBeenCalled();
208-
expect(testContext.needsRedraw).not.toHaveBeenCalled();
209-
});
210-
});
211165

212166
it('should use the setVisible method on the correct series when the visibility changes', () => {
213167
const wrapper = mount(

packages/react-jsx-highcharts/webpack.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ const webpackConfig = {
3737
commonjs2: 'highcharts',
3838
amd: 'highcharts',
3939
root: 'Highcharts'
40-
},
41-
'immutable': {
42-
commonjs: 'immutable',
43-
commonjs2: 'immutable',
44-
amd: 'immutable',
45-
root: 'Immutable'
4640
}
4741
},
4842

packages/react-jsx-highmaps/webpack.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ const webpackConfig = {
3737
commonjs2: 'highcharts',
3838
amd: 'highcharts',
3939
root: 'Highcharts'
40-
},
41-
'immutable': {
42-
commonjs: 'immutable',
43-
commonjs2: 'immutable',
44-
amd: 'immutable',
45-
root: 'Immutable'
4640
}
4741
},
4842

packages/react-jsx-highstock/webpack.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ const webpackConfig = {
3737
commonjs2: 'highcharts',
3838
amd: 'highcharts',
3939
root: 'Highcharts'
40-
},
41-
'immutable': {
42-
commonjs: 'immutable',
43-
commonjs2: 'immutable',
44-
amd: 'immutable',
45-
root: 'Immutable'
4640
}
4741
},
4842

0 commit comments

Comments
 (0)