Skip to content

Commit 1918b36

Browse files
committed
refactor: prefix lifecycle methods with UNSAFE_
Refs #7341
1 parent 14efcff commit 1918b36

18 files changed

+291
-30739
lines changed

package-lock.json

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

src/core/components/content-type.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class ContentType extends React.Component {
3030
}
3131
}
3232

33-
componentWillReceiveProps(nextProps) {
33+
UNSAFE_componentWillReceiveProps(nextProps) {
3434
if(!nextProps.contentTypes || !nextProps.contentTypes.size) {
3535
return
3636
}

src/core/components/examples-select-value-retainer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default class ExamplesSelectValueRetainer extends React.PureComponent {
117117
}
118118

119119
_getValueForExample = (exampleKey, props) => {
120-
// props are accepted so that this can be used in componentWillReceiveProps,
120+
// props are accepted so that this can be used in UNSAFE_componentWillReceiveProps,
121121
// which has access to `nextProps`
122122
const { examples } = props || this.props
123123
return stringifyUnlessList(
@@ -126,7 +126,7 @@ export default class ExamplesSelectValueRetainer extends React.PureComponent {
126126
}
127127

128128
_getCurrentExampleValue = props => {
129-
// props are accepted so that this can be used in componentWillReceiveProps,
129+
// props are accepted so that this can be used in UNSAFE_componentWillReceiveProps,
130130
// which has access to `nextProps`
131131
const { currentKey } = props || this.props
132132
return this._getValueForExample(currentKey, props || this.props)
@@ -169,7 +169,7 @@ export default class ExamplesSelectValueRetainer extends React.PureComponent {
169169
}
170170
}
171171

172-
componentWillReceiveProps(nextProps) {
172+
UNSAFE_componentWillReceiveProps(nextProps) {
173173
// update `lastUserEditedValue` as new currentUserInput values come in
174174

175175
const {

src/core/components/examples-select.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class ExamplesSelect extends React.PureComponent {
7878
}
7979
}
8080

81-
componentWillReceiveProps(nextProps) {
81+
UNSAFE_componentWillReceiveProps(nextProps) {
8282
const { currentExampleKey, examples } = nextProps
8383
if (examples !== this.props.examples && !examples.has(currentExampleKey)) {
8484
// examples have changed from under us, and the currentExampleKey is no longer

src/core/components/layout-utils.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export class Select extends React.Component {
181181
onChange && onChange(value)
182182
}
183183

184-
componentWillReceiveProps(nextProps) {
184+
UNSAFE_componentWillReceiveProps(nextProps) {
185185
// TODO: this puts us in a weird area btwn un/controlled selection... review
186186
if(nextProps.value !== this.props.value) {
187187
this.setState({ value: nextProps.value })

src/core/components/model-collapse.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class ModelCollapse extends Component {
4848
}
4949
}
5050

51-
componentWillReceiveProps(nextProps){
51+
UNSAFE_componentWillReceiveProps(nextProps){
5252
if(this.props.expanded !== nextProps.expanded){
5353
this.setState({expanded: nextProps.expanded})
5454
}

src/core/components/model-example.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class ModelExample extends React.Component {
4343
})
4444
}
4545

46-
componentWillReceiveProps(nextProps) {
46+
UNSAFE_componentWillReceiveProps(nextProps) {
4747
if (
4848
nextProps.isExecute &&
4949
!this.props.isExecute &&

src/core/components/online-validator-badge.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class OnlineValidatorBadge extends React.Component {
3030
return urlObject.toString()
3131
}
3232

33-
componentWillReceiveProps(nextProps) {
33+
UNSAFE_componentWillReceiveProps(nextProps) {
3434
let { getConfigs } = nextProps
3535
let { validatorUrl } = getConfigs()
3636

@@ -91,7 +91,7 @@ class ValidatorImage extends React.Component {
9191
img.src = this.props.src
9292
}
9393

94-
componentWillReceiveProps(nextProps) {
94+
UNSAFE_componentWillReceiveProps(nextProps) {
9595
if (nextProps.src !== this.props.src) {
9696
const img = new Image()
9797
img.onload = () => {

src/core/components/param-body.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default class ParamBody extends PureComponent {
4343
this.updateValues.call(this, this.props)
4444
}
4545

46-
componentWillReceiveProps(nextProps) {
46+
UNSAFE_componentWillReceiveProps(nextProps) {
4747
this.updateValues.call(this, nextProps)
4848
}
4949

@@ -140,11 +140,11 @@ export default class ParamBody extends PureComponent {
140140
}
141141
<label htmlFor="">
142142
<span>Parameter content type</span>
143-
<ContentType
144-
value={ consumesValue }
145-
contentTypes={ consumes }
146-
onChange={onChangeConsumes}
147-
className="body-param-content-type"
143+
<ContentType
144+
value={ consumesValue }
145+
contentTypes={ consumes }
146+
onChange={onChangeConsumes}
147+
className="body-param-content-type"
148148
ariaLabel="Parameter content type" />
149149
</label>
150150
</div>

src/core/components/parameter-row.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class ParameterRow extends Component {
3030
this.setDefaultValue()
3131
}
3232

33-
componentWillReceiveProps(props) {
33+
UNSAFE_componentWillReceiveProps(props) {
3434
let { specSelectors, pathMethod, rawParam } = props
3535
let isOAS3 = specSelectors.isOAS3()
3636

@@ -127,7 +127,7 @@ export default class ParameterRow extends Component {
127127
: (schema && schema.getIn(["default"]))
128128
} else if (specSelectors.isOAS3()) {
129129
const currentExampleKey = oas3Selectors.activeExamplesMember(...pathMethod, "parameters", this.getParamKey())
130-
initialValue =
130+
initialValue =
131131
paramWithMeta.getIn(["examples", currentExampleKey, "value"]) !== undefined
132132
? paramWithMeta.getIn(["examples", currentExampleKey, "value"])
133133
: paramWithMeta.getIn(["content", parameterMediaType, "example"]) !== undefined

0 commit comments

Comments
 (0)