Skip to content

Commit

Permalink
Update legacy React lifecycle methods to indicate unsafe status (jaeg…
Browse files Browse the repository at this point in the history
…ertracing#610)

Following the react migration path laid out here https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html

Signed-off-by: Tim Klever <[email protected]>
Signed-off-by: vvvprabhakar <[email protected]>
  • Loading branch information
tklever authored and vvvprabhakar committed Jul 4, 2021
1 parent e52faa8 commit e325215
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/jaeger-ui/src/components/App/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export class PageImpl extends React.Component<TProps> {
trackPageView(pathname, search);
}

componentWillReceiveProps(nextProps: TProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: TProps) {
const { pathname, search } = this.props;
const { pathname: nextPathname, search: nextSearch } = nextProps;
if (pathname !== nextPathname || search !== nextSearch) {
Expand Down
3 changes: 2 additions & 1 deletion packages/jaeger-ui/src/components/DeepDependencies/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export class DeepDependencyGraphPageImpl extends React.PureComponent<TProps, TSt
}
}

componentWillReceiveProps(nextProps: TProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: TProps) {
DeepDependencyGraphPageImpl.fetchModelIfStale(nextProps);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export default class DependencyForceGraph extends Component {
};
}

componentWillMount() {
// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
this.onResize();
this.debouncedResize = debounce((...args) => this.onResize(...args), 50);
window.addEventListener('resize', this.debouncedResize);
Expand Down
3 changes: 2 additions & 1 deletion packages/jaeger-ui/src/components/DependencyGraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export class DependencyGraphPageImpl extends Component {
};
}

componentWillMount() {
// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
this.props.fetchDependencies();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default class ArchiveNotifier extends React.PureComponent<Props, State> {
this.state = { notifiedState };
}

componentWillReceiveProps(nextProps: Props) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const notifiedState = processProps(this.state.notifiedState, nextProps);
if (this.state.notifiedState !== notifiedState) {
this.setState({ notifiedState });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export default class SpanGraph extends React.PureComponent<SpanGraphProps, SpanG
};
}

componentWillReceiveProps(nextProps: SpanGraphProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: SpanGraphProps) {
const { trace } = nextProps;
if (this.props.trace !== trace) {
this.setState({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ type State = {
* Used to render the detail column.
*/
export default class DetailTableData extends Component<Props, State> {
componentWillMount() {
// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
const element = this.props.values.map(item => {
return { uid: _.uniqueId('id'), value: item };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type State = {
* Used to render the main column.
*/
export default class MainTableData extends Component<Props, State> {
componentWillMount() {
// eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
const element = this.props.values.map(item => {
return { uid: _.uniqueId('id'), value: item };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ export default class TimelineViewingLayer extends React.PureComponent<TimelineVi
this._root = undefined;
}

componentWillReceiveProps(nextProps: TimelineViewingLayerProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: TimelineViewingLayerProps) {
const { boundsInvalidator } = this.props;
if (boundsInvalidator !== nextProps.boundsInvalidator) {
this._draggerReframe.resetBounds();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export class VirtualizedTraceViewImpl extends React.Component<VirtualizedTraceVi
return false;
}

componentWillUpdate(nextProps: VirtualizedTraceViewProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillUpdate(nextProps: VirtualizedTraceViewProps) {
const { childrenHiddenIDs, detailStates, registerAccessors, trace, currentViewRangeTime } = this.props;
const {
currentViewRangeTime: nextViewRangeTime,
Expand Down
3 changes: 2 additions & 1 deletion packages/jaeger-ui/src/components/TracePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ export class TracePageImpl extends React.PureComponent<TProps, TState> {
mergeShortcuts(shortcutCallbacks);
}

componentWillReceiveProps(nextProps: TProps) {
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps: TProps) {
const { trace } = nextProps;
this._scrollManager.setTrace(trace && trace.data);
}
Expand Down

0 comments on commit e325215

Please sign in to comment.