Skip to content

Commit d38b3b6

Browse files
committed
componentWillMount => UNSAFE_componentWillMount => componentDidMount
1 parent d21fa31 commit d38b3b6

File tree

12 files changed

+15
-15
lines changed

12 files changed

+15
-15
lines changed

packages/react-form-with-constraints-material-ui/src/Material.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class FormControl extends React.Component<FormControlProps, FormControlSt
4343

4444
/* eslint-disable react/destructuring-assignment */
4545

46-
componentWillMount() {
46+
componentDidMount() {
4747
this.context.form.addFieldWillValidateEventListener(this.fieldWillValidate);
4848
this.context.form.addFieldDidValidateEventListener(this.fieldDidValidate);
4949
this.context.form.addFieldDidResetEventListener(this.fieldDidReset);
@@ -122,7 +122,7 @@ export class TextField extends React.Component<TextFieldProps, TextFieldState> {
122122

123123
/* eslint-disable react/destructuring-assignment */
124124

125-
componentWillMount() {
125+
componentDidMount() {
126126
this.context.form.addFieldWillValidateEventListener(this.fieldWillValidate);
127127
this.context.form.addFieldDidValidateEventListener(this.fieldDidValidate);
128128
this.context.form.addFieldDidResetEventListener(this.fieldDidReset);

packages/react-form-with-constraints-tools/src/DisplayFields.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function shallow(node: React.ReactElement, options: { context: FormWithConstrain
2323
return _shallow(node, options);
2424
}
2525

26-
test('componentWillMount() componentWillUnmount()', () => {
26+
test('componentDidMount() componentWillUnmount()', () => {
2727
const form = new FormWithConstraints({});
2828
const fieldsStoreAddListenerSpy = jest.spyOn(form.fieldsStore, 'addListener');
2929
const fieldsStoreRemoveListenerSpy = jest.spyOn(form.fieldsStore, 'removeListener');

packages/react-form-with-constraints-tools/src/DisplayFields.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class DisplayFields extends React.Component {
9090

9191
/* eslint-disable react/destructuring-assignment */
9292

93-
componentWillMount() {
93+
componentDidMount() {
9494
this.context.form.fieldsStore.addListener(FieldEvent.Added, this.reRender);
9595
this.context.form.fieldsStore.addListener(FieldEvent.Removed, this.reRender);
9696
this.context.form.addFieldDidValidateEventListener(this.reRender);

packages/react-form-with-constraints/src/Async.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ beforeEach(() => {
4242
{ for: 'username', stop: 'no' },
4343
{ form: form_username }
4444
);
45-
fieldFeedbacks_username.componentWillMount(); // Needed because of fieldsStore.addField() inside componentWillMount()
45+
fieldFeedbacks_username.componentDidMount(); // Needed because of fieldsStore.addField() inside componentDidMount()
4646
});
4747

4848
test('constructor()', () => {
@@ -53,7 +53,7 @@ test('constructor()', () => {
5353
expect(async.state).toEqual({ status: Status.None });
5454
});
5555

56-
test('componentWillMount() componentWillUnmount()', () => {
56+
test('componentDidMount() componentWillUnmount()', () => {
5757
const addValidateFieldEventListenerSpy = jest.spyOn(
5858
fieldFeedbacks_username,
5959
'addValidateFieldEventListener'

packages/react-form-with-constraints/src/Async.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class Async<T>
6464
status: Status.None
6565
};
6666

67-
componentWillMount() {
67+
componentDidMount() {
6868
this.context.fieldFeedbacks.addValidateFieldEventListener(this.validate);
6969
}
7070

packages/react-form-with-constraints/src/FieldFeedback.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ beforeEach(() => {
4040
{ for: 'username', stop: 'no' },
4141
{ form: form_username }
4242
);
43-
fieldFeedbacks_username.componentWillMount(); // Needed because of fieldsStore.addField() inside componentWillMount()
43+
fieldFeedbacks_username.componentDidMount(); // Needed because of fieldsStore.addField() inside componentDidMount()
4444
});
4545

4646
describe('constructor()', () => {
@@ -81,7 +81,7 @@ describe('constructor()', () => {
8181
});
8282
});
8383

84-
test('componentWillMount() componentWillUnmount()', () => {
84+
test('componentDidMount() componentWillUnmount()', () => {
8585
const addValidateFieldEventListenerSpy = jest.spyOn(
8686
fieldFeedbacks_username,
8787
'addValidateFieldEventListener'

packages/react-form-with-constraints/src/FieldFeedback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class FieldFeedback<
115115
};
116116
}
117117

118-
componentWillMount() {
118+
componentDidMount() {
119119
const { form, fieldFeedbacks, async } = this.context;
120120

121121
if (async) async.addValidateFieldEventListener(this.validate);

packages/react-form-with-constraints/src/FieldFeedbackWhenValid.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test('constructor()', () => {
3939
expect(fieldFeedbackWhenValid.state.fieldIsValid).toEqual(undefined);
4040
});
4141

42-
test('componentWillMount() componentWillUnmount()', () => {
42+
test('componentDidMount() componentWillUnmount()', () => {
4343
const addFieldWillValidateEventListenerSpy = jest.spyOn(
4444
form_username,
4545
'addFieldWillValidateEventListener'

packages/react-form-with-constraints/src/FieldFeedbackWhenValid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class FieldFeedbackWhenValid<
3535

3636
/* eslint-disable react/destructuring-assignment */
3737

38-
componentWillMount() {
38+
componentDidMount() {
3939
this.context.form.addFieldWillValidateEventListener(this.fieldWillValidate);
4040
this.context.form.addFieldDidValidateEventListener(this.fieldDidValidate);
4141
this.context.form.addFieldDidResetEventListener(this.fieldDidReset);

packages/react-form-with-constraints/src/FieldFeedbacks.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test('computeFieldFeedbackKey()', () => {
8282
expect(fieldFeedbacks.computeFieldFeedbackKey()).toEqual('0.10');
8383
});
8484

85-
describe('componentWillMount()', () => {
85+
describe('componentDidMount()', () => {
8686
test('initialize FieldsStore', () => {
8787
const form = new FormWithConstraints({});
8888
expect(form.fieldsStore.fields).toEqual([]);

0 commit comments

Comments
 (0)