React: Rename deprecated UNSAFE_componentWillReceiveProps (#18526)

This commit is contained in:
Ryan McKinley
2019-08-13 01:08:33 -07:00
committed by Torkel Ödegaard
parent 4b3440325e
commit 3ccc10f82c
6 changed files with 6 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ class PopperController extends React.Component<Props, State> {
}; };
} }
componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.placement && nextProps.placement !== this.state.placement) { if (nextProps.placement && nextProps.placement !== this.state.placement) {
this.setState((prevState: State) => { this.setState((prevState: State) => {
return { return {

View File

@@ -35,7 +35,7 @@ export class MetricSelect extends React.Component<Props, State> {
this.setState({ options: this.buildOptions(this.props) }); this.setState({ options: this.buildOptions(this.props) });
} }
componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.options.length > 0 || nextProps.variables.length) { if (nextProps.options.length > 0 || nextProps.variables.length) {
this.setState({ options: this.buildOptions(nextProps) }); this.setState({ options: this.buildOptions(nextProps) });
} }

View File

@@ -33,7 +33,7 @@ export default class ElapsedTime extends PureComponent<Props, State> {
this.setState({ elapsed }); this.setState({ elapsed });
}; };
componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.time) { if (nextProps.time) {
clearInterval(this.timer); clearInterval(this.timer);
} else if (this.props.time) { } else if (this.props.time) {

View File

@@ -125,7 +125,7 @@ export class QueryField extends React.PureComponent<QueryFieldProps, QueryFieldS
} }
} }
componentWillReceiveProps(nextProps: QueryFieldProps) { UNSAFE_componentWillReceiveProps(nextProps: QueryFieldProps) {
if (nextProps.syntaxLoaded && !this.props.syntaxLoaded) { if (nextProps.syntaxLoaded && !this.props.syntaxLoaded) {
// Need a bogus edit to re-render the editor after syntax has fully loaded // Need a bogus edit to re-render the editor after syntax has fully loaded
const change = this.state.value const change = this.state.value

View File

@@ -33,7 +33,7 @@ export class Aggregations extends React.Component<Props, State> {
this.setAggOptions(this.props); this.setAggOptions(this.props);
} }
componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
this.setAggOptions(nextProps); this.setAggOptions(nextProps);
} }

View File

@@ -24,7 +24,7 @@ export class AliasBy extends Component<Props, State> {
this.setState({ value: this.props.value }); this.setState({ value: this.props.value });
} }
componentWillReceiveProps(nextProps: Props) { UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.value !== this.props.value) { if (nextProps.value !== this.props.value) {
this.setState({ value: nextProps.value }); this.setState({ value: nextProps.value });
} }