Skip to content

Commit a3852ef

Browse files
skovyCompuIves
authored andcommitted
Rename unsafe React lifecycle methods (codesandbox#2159)
1 parent 9063e5d commit a3852ef

File tree

21 files changed

+21
-21
lines changed

21 files changed

+21
-21
lines changed

packages/app/src/app/components/CodeEditor/FuzzySearch/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class FuzzySearch extends React.PureComponent {
2323
// This is a precached map of paths to module
2424
paths = {};
2525

26-
componentWillMount() {
26+
UNSAFE_componentWillMount() {
2727
const { modules, directories } = this.props;
2828
const modulePathData = modules.map(m => {
2929
const path = getModulePath(modules, directories, m.id);

packages/app/src/app/components/CodeEditor/MonacoDiff/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default class MonacoDiff extends React.Component<Props>
2929
this.settings = props.settings;
3030
}
3131

32-
componentWillUpdate(nextProps: Props) {
32+
UNSAFE_componentWillUpdate(nextProps: Props) {
3333
if (
3434
this.props.originalCode !== nextProps.originalCode ||
3535
this.props.modifiedCode !== nextProps.modifiedCode

packages/app/src/app/components/ModeIcons/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class ModeIcons extends React.PureComponent {
8181
}
8282
};
8383

84-
componentWillReceiveProps(nextProps) {
84+
UNSAFE_componentWillReceiveProps(nextProps) {
8585
const { currentMode, otherModes } = getCurrentMode(nextProps);
8686

8787
if (!this.state.hovering) {

packages/app/src/app/components/Preview/DevTools/Console/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class Console extends React.Component<StyledProps> {
163163

164164
list;
165165

166-
componentWillReceiveProps(nextProps) {
166+
UNSAFE_componentWillReceiveProps(nextProps) {
167167
if (nextProps.sandboxId !== this.props.sandboxId) {
168168
this.clearConsole(true);
169169
}

packages/app/src/app/components/Preview/DevTools/Tests/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Tests extends React.Component<DevToolProps, State> {
175175
}
176176
}
177177

178-
componentWillReceiveProps(nextProps: DevToolProps) {
178+
UNSAFE_componentWillReceiveProps(nextProps: DevToolProps) {
179179
if (nextProps.sandboxId !== this.props.sandboxId) {
180180
this.setState({
181181
files: {},

packages/app/src/app/components/SubscribeForm/CheckoutForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CheckoutForm extends React.PureComponent<Props, State> {
4343
loading: false,
4444
};
4545

46-
componentWillReceiveProps(nextProps: Props) {
46+
UNSAFE_componentWillReceiveProps(nextProps: Props) {
4747
if (nextProps.name !== this.props.name) {
4848
this.setState({ errors: {}, name: nextProps.name });
4949
}

packages/app/src/app/pages/Dashboard/Content/DragLayer/SelectedSandboxItems/AnimatedSandboxItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type Props = {
2020

2121
export default class AnimatedSandboxItem extends React.Component<Props> {
2222
state = { render: true };
23-
componentWillMount() {
23+
UNSAFE_componentWillMount() {
2424
const sandboxBrotherItem = document.getElementById(this.props.id);
2525

2626
if (sandboxBrotherItem) {

packages/app/src/app/pages/Dashboard/Content/SandboxCard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class SandboxItem extends React.PureComponent<Props, State> {
120120
}
121121
}
122122

123-
componentWillReceiveProps(nextProps) {
123+
UNSAFE_componentWillReceiveProps(nextProps) {
124124
if (nextProps.id !== this.props.id) {
125125
this.setState({ screenshotUrl: nextProps.screenshotUrl }, () => {
126126
this.checkScreenshot();

packages/app/src/app/pages/Dashboard/Sidebar/Item/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class Item extends React.Component {
3131
this.setState(state => ({ open: !state.open }));
3232
};
3333

34-
componentWillReceiveProps(nextProps) {
34+
UNSAFE_componentWillReceiveProps(nextProps) {
3535
if (nextProps.openByDefault === true && !this.props.openByDefault) {
3636
this.setState({ open: true });
3737
}

packages/app/src/app/pages/Dashboard/Sidebar/SandboxesItem/FolderEntry/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class FolderEntry extends React.Component<Props, State> {
8282
depth: 0,
8383
};
8484

85-
componentWillReceiveProps(nextProps) {
85+
UNSAFE_componentWillReceiveProps(nextProps) {
8686
if (
8787
(this.state.open == null || this.state.open === false) &&
8888
nextProps.open === true

0 commit comments

Comments
 (0)