Skip to content

Commit defa252

Browse files
committed
Rename deprecated React APIs
1 parent 789e549 commit defa252

37 files changed

+38
-38
lines changed

dev/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class App extends Component {
118118
this.updateState = this.updateState.bind(this);
119119
}
120120

121-
componentWillMount() {
121+
UNSAFE_componentWillMount() {
122122
// curl https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks \
123123
// | jq '[.[] | .name ]' > mocks.json
124124
fetch('/mocks.json')

examples/demo/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class App extends Component {
2727
this.loadMock = this.loadMock.bind(this);
2828
}
2929

30-
componentWillMount() {
30+
UNSAFE_componentWillMount() {
3131
fetch('https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks')
3232
.then(response => response.json())
3333
.then(mocks => this.setState({mocks}));

src/components/containers/PlotlyFold.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class PlotlyFold extends Fold {
177177
this.determineVisibility(props, context);
178178
}
179179

180-
componentWillReceiveProps(nextProps, nextContext) {
180+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
181181
this.determineVisibility(nextProps, nextContext);
182182
}
183183

src/components/containers/PlotlySection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class PlotlySection extends Section {
4343
this.determineVisibility(props, context);
4444
}
4545

46-
componentWillReceiveProps(nextProps, nextContext) {
46+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
4747
this.determineVisibility(nextProps, nextContext);
4848
}
4949

src/components/containers/TraceAccordion.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TraceAccordion extends Component {
1717
this.setLocals(props, context);
1818
}
1919

20-
componentWillReceiveProps(nextProps, nextContext) {
20+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
2121
this.setLocals(nextProps, nextContext);
2222
}
2323

src/components/containers/TraceMarkerSection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class TraceMarkerSection extends Component {
88
this.setLocals(context);
99
}
1010

11-
componentWillReceiveProps(nextProps, nextContext) {
11+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1212
this.setLocals(nextContext);
1313
}
1414

src/components/fields/DataSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class UnconnectedDataSelector extends Component {
1919
this.setLocals(props, context);
2020
}
2121

22-
componentWillReceiveProps(nextProps, nextContext) {
22+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
2323
this.setLocals(nextProps, nextContext);
2424
}
2525

src/components/fields/DropdownCustom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class UnconnectedDropdownCustom extends Component {
2222
};
2323
}
2424

25-
componentWillReceiveProps(props) {
25+
UNSAFE_componentWillReceiveProps(props) {
2626
this.setLocals(props);
2727
}
2828

src/components/fields/HoverLabelNameLength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class UnconnectedHoverLabelNameLength extends Component {
1818
return props.fullValue > 0 ? 'clip' : props.fullValue === 0 ? 'hide' : 'no-clip';
1919
}
2020

21-
componentWillReceiveProps(nextProps) {
21+
UNSAFE_componentWillReceiveProps(nextProps) {
2222
if (nextProps.fullValue !== this.props.fullValue) {
2323
this.setState({
2424
currentOption: this.getCurrentOption(nextProps),

src/components/fields/LineSelectors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class LineSelector extends Component {
6767
this.setLocals(props, context);
6868
}
6969

70-
componentWillReceiveProps(nextProps, nextContext) {
70+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
7171
this.setLocals(nextProps, nextContext);
7272
}
7373

src/components/fields/LocationSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class UnconnectedLocationSelector extends Component {
6565
this.setMode = this.setMode.bind(this);
6666
}
6767

68-
componentWillMount() {
68+
UNSAFE_componentWillMount() {
6969
this.setState({
7070
mode: this.props.container.locations ? 'location' : 'latlon',
7171
});

src/components/fields/SymbolSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class SymbolSelector extends Component {
351351
this.setLocals(props, context);
352352
}
353353

354-
componentWillReceiveProps(nextProps, nextContext) {
354+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
355355
this.setLocals(nextProps, nextContext);
356356
}
357357

src/components/fields/TraceSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TraceSelector extends Component {
6161
}
6262
}
6363

64-
componentWillReceiveProps(nextProps, nextContext) {
64+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
6565
const {container, fullContainer, updateContainer} = nextProps;
6666
this.setTraceDefaults(container, fullContainer, updateContainer);
6767
this.setLocals(nextProps, nextContext);

src/components/fields/VisibilitySelect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class UnconnectedVisibilitySelect extends Component {
1616
this.setLocals(props);
1717
}
1818

19-
componentWillReceiveProps(props) {
19+
UNSAFE_componentWillReceiveProps(props) {
2020
this.setLocals(props);
2121
}
2222

src/components/widgets/CheckboxGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class CheckboxGroup extends Component {
1010
this.handleChange = this.handleChange.bind(this);
1111
}
1212

13-
componentWillReceiveProps(nextProps) {
13+
UNSAFE_componentWillReceiveProps(nextProps) {
1414
this.setState({options: nextProps.options});
1515
}
1616

src/components/widgets/Dropzone.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Dropzone extends Component {
4040
return <div className="dropzone-container__message">{_('File loaded!')}</div>;
4141
}
4242

43-
componentWillMount() {
43+
UNSAFE_componentWillMount() {
4444
const _ = this.context.localize;
4545

4646
if (this.props.value && this.props.value !== '') {

src/components/widgets/FlaglistCheckboxGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class FlaglistCheckboxGroup extends Component {
3737
}
3838

3939
// Sync local state to parent props.
40-
componentWillReceiveProps(nextProps) {
40+
UNSAFE_componentWillReceiveProps(nextProps) {
4141
this.setState({activeOption: this.parseFlags(nextProps.activeOption)});
4242
}
4343

src/components/widgets/NumericInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class NumericInput extends Component {
3131
}`;
3232
}
3333

34-
componentWillReceiveProps(nextProps) {
34+
UNSAFE_componentWillReceiveProps(nextProps) {
3535
if (nextProps.value !== this.state.value) {
3636
this.setState({value: nextProps.value});
3737
}

src/components/widgets/RadioBlocks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class RadioBlocks extends Component {
1010
this.renderOption = this.renderOption.bind(this);
1111
}
1212

13-
componentWillReceiveProps(nextProps) {
13+
UNSAFE_componentWillReceiveProps(nextProps) {
1414
// Reset the value to the graph's actual value
1515
if (nextProps.activeOption !== this.state.activeOption) {
1616
this.setState({

src/components/widgets/TextArea.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class TextArea extends Component {
1212
this.onChange = this.onChange.bind(this);
1313
}
1414

15-
componentWillReceiveProps(nextProps) {
15+
UNSAFE_componentWillReceiveProps(nextProps) {
1616
// Reset the value to the graph's actual value
1717
if (nextProps.value !== this.state.value) {
1818
this.setState({

src/components/widgets/TextInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class TextInput extends Component {
99
this.state = {value: props.value};
1010
}
1111

12-
componentWillReceiveProps(nextProps) {
12+
UNSAFE_componentWillReceiveProps(nextProps) {
1313
if (nextProps.value !== this.state.value) {
1414
this.setState({value: nextProps.value});
1515
}

src/components/widgets/text_editors/LaTeX.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class LaTeX extends TextArea {
1919
this.onBlur = this.onBlur.bind(this);
2020
}
2121

22-
componentWillReceiveProps(nextProps) {
22+
UNSAFE_componentWillReceiveProps(nextProps) {
2323
const unwrappedNextValue = this.unwrap(nextProps.value);
2424

2525
if (unwrappedNextValue !== this.state.value) {

src/components/widgets/text_editors/RichText/LinkEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class LinkEditor extends Component {
2626
}
2727
}
2828

29-
componentWillReceiveProps(nextProps) {
29+
UNSAFE_componentWillReceiveProps(nextProps) {
3030
const {props} = this;
3131

3232
// Update position if we are editing a new link

src/components/widgets/text_editors/RichText/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RichText extends Component {
4141
* After this, as long as this component is mounted, it owns the source
4242
* of truth for the annotation value via `this.state.editorState`.
4343
* This state may be updated externally via a prop update.
44-
* See `componentWillReceiveProps`.
44+
* See `UNSAFE_componentWillReceiveProps`.
4545
*/
4646
this.state = {
4747
editorState: props.value.toString().trim().length
@@ -67,7 +67,7 @@ class RichText extends Component {
6767
this.renderLinkEditor = this.renderLinkEditor.bind(this);
6868
}
6969

70-
componentWillReceiveProps(nextProps) {
70+
UNSAFE_componentWillReceiveProps(nextProps) {
7171
const {linkEditorFocus, editorFocus} = this.state;
7272

7373
/*

src/lib/connectAggregationToTransform.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function connectAggregationToTransform(WrappedComponent) {
1111
this.setLocals(props, context);
1212
}
1313

14-
componentWillReceiveProps(nextProps, nextContext) {
14+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1515
this.setLocals(nextProps, nextContext);
1616
}
1717

src/lib/connectAnnotationToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function connectAnnotationToLayout(WrappedComponent) {
1414
this.setLocals(props, context);
1515
}
1616

17-
componentWillReceiveProps(nextProps, nextContext) {
17+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1818
this.setLocals(nextProps, nextContext);
1919
}
2020

src/lib/connectCartesianSubplotToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function connectCartesianSubplotToLayout(WrappedComponent) {
1111
this.setLocals(props, context);
1212
}
1313

14-
componentWillReceiveProps(nextProps, nextContext) {
14+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1515
this.setLocals(nextProps, nextContext);
1616
}
1717

src/lib/connectImageToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function connectImageToLayout(WrappedComponent) {
1414
this.setLocals(props, context);
1515
}
1616

17-
componentWillReceiveProps(nextProps, nextContext) {
17+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1818
this.setLocals(nextProps, nextContext);
1919
}
2020

src/lib/connectLayersToMapbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function connectLayersToMapbox(WrappedComponent) {
1414
this.setLocals(props, context);
1515
}
1616

17-
componentWillReceiveProps(nextProps, nextContext) {
17+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1818
this.setLocals(nextProps, nextContext);
1919
}
2020

src/lib/connectNonCartesianSubplotToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function connectNonCartesianSubplotToLayout(WrappedComponent) {
1111
this.setLocals(props, context);
1212
}
1313

14-
componentWillReceiveProps(nextProps, nextContext) {
14+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1515
this.setLocals(nextProps, nextContext);
1616
}
1717

src/lib/connectRangeSelectorToAxis.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function connectRangeSelectorToAxis(WrappedComponent) {
1313
this.setLocals(props, context);
1414
}
1515

16-
componentWillReceiveProps(nextProps, nextContext) {
16+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1717
this.setLocals(nextProps, nextContext);
1818
}
1919

src/lib/connectShapeToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function connectShapeToLayout(WrappedComponent) {
1414
this.setLocals(props, context);
1515
}
1616

17-
componentWillReceiveProps(nextProps, nextContext) {
17+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1818
this.setLocals(nextProps, nextContext);
1919
}
2020

src/lib/connectSliderToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function connectSliderToLayout(WrappedComponent) {
1010
this.setLocals(props, context);
1111
}
1212

13-
componentWillReceiveProps(nextProps, nextContext) {
13+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1414
this.setLocals(nextProps, nextContext);
1515
}
1616

src/lib/connectToContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function connectToContainer(WrappedComponent, config = {}) {
4141
this.setLocals(props, context);
4242
}
4343

44-
componentWillReceiveProps(nextProps, nextContext) {
44+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
4545
this.setLocals(nextProps, nextContext);
4646
}
4747

src/lib/connectTraceToPlot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function connectTraceToPlot(WrappedComponent) {
2323
this.setLocals(props, context);
2424
}
2525

26-
componentWillReceiveProps(nextProps, nextContext) {
26+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
2727
this.setLocals(nextProps, nextContext);
2828
}
2929

src/lib/connectTransformToTrace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function connectTransformToTrace(WrappedComponent) {
1313
this.setLocals(props, context);
1414
}
1515

16-
componentWillReceiveProps(nextProps, nextContext) {
16+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1717
this.setLocals(nextProps, nextContext);
1818
}
1919

src/lib/connectUpdateMenuToLayout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function connectUpdateMenuToLayout(WrappedComponent) {
1010
this.setLocals(props, context);
1111
}
1212

13-
componentWillReceiveProps(nextProps, nextContext) {
13+
UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
1414
this.setLocals(nextProps, nextContext);
1515
}
1616

0 commit comments

Comments
 (0)