Browse Source

React: Rename deprecated UNSAFE_componentWillReceiveProps (#18526)

Ryan McKinley 6 years ago
parent
commit
3ccc10f82c

+ 1 - 1
packages/grafana-ui/src/components/Tooltip/PopperController.tsx

@@ -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 {

+ 1 - 1
public/app/core/components/Select/MetricSelect.tsx

@@ -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) });
     }
     }

+ 1 - 1
public/app/features/explore/ElapsedTime.tsx

@@ -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) {

+ 1 - 1
public/app/features/explore/QueryField.tsx

@@ -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

+ 1 - 1
public/app/plugins/datasource/stackdriver/components/Aggregations.tsx

@@ -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);
   }
   }
 
 

+ 1 - 1
public/app/plugins/datasource/stackdriver/components/AliasBy.tsx

@@ -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 });
     }
     }