mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
React: Rename deprecated UNSAFE_componentWillReceiveProps (#18526)
This commit is contained in:
committed by
Torkel Ödegaard
parent
4b3440325e
commit
3ccc10f82c
@@ -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) {
|
||||
this.setState((prevState: State) => {
|
||||
return {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class MetricSelect extends React.Component<Props, State> {
|
||||
this.setState({ options: this.buildOptions(this.props) });
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps: Props) {
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.options.length > 0 || nextProps.variables.length) {
|
||||
this.setState({ options: this.buildOptions(nextProps) });
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class ElapsedTime extends PureComponent<Props, State> {
|
||||
this.setState({ elapsed });
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps: Props) {
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.time) {
|
||||
clearInterval(this.timer);
|
||||
} else if (this.props.time) {
|
||||
|
||||
@@ -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) {
|
||||
// Need a bogus edit to re-render the editor after syntax has fully loaded
|
||||
const change = this.state.value
|
||||
|
||||
@@ -33,7 +33,7 @@ export class Aggregations extends React.Component<Props, State> {
|
||||
this.setAggOptions(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps: Props) {
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
this.setAggOptions(nextProps);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export class AliasBy extends Component<Props, State> {
|
||||
this.setState({ value: this.props.value });
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps: Props) {
|
||||
UNSAFE_componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.value !== this.props.value) {
|
||||
this.setState({ value: nextProps.value });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user