Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] [Dependencies]: upgrade react to latest v16.12.0 (#51145) #51868

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,16 @@
},
"resolutions": {
"**/@types/node": "10.12.27",
"**/@types/react": "16.8.3",
"**/@types/react": "^16.9.13",
"**/@types/hapi": "^17.0.18",
"**/@types/angular": "^1.6.56",
"**/typescript": "3.7.2",
"**/graphql-toolkit/lodash": "^4.17.13",
"**/isomorphic-git/**/base64-js": "^1.2.1",
"**/image-diff/gm/debug": "^2.6.9",
"**/deepmerge": "^4.2.2",
"**/react": "16.8.6",
"**/react-dom": "16.8.6",
"**/react-test-renderer": "16.8.6"
"**/react-dom": "^16.12.0",
"**/react-test-renderer": "^16.12.0",
"**/deepmerge": "^4.2.2"
},
"workspaces": {
"packages": [
Expand Down Expand Up @@ -214,15 +213,13 @@
"pug": "^2.0.3",
"querystring-browser": "1.0.4",
"raw-loader": "3.1.0",
"react": "^16.8.6",
"react-addons-shallow-compare": "15.6.2",
"react": "^16.12.0",
"react-color": "^2.13.8",
"react-dom": "^16.8.6",
"react-dom": "^16.12.0",
"react-grid-layout": "^0.16.2",
"react-hooks-testing-library": "^0.5.0",
"react-input-range": "^1.3.0",
"react-markdown": "^3.4.1",
"react-redux": "^5.1.1",
"react-redux": "^5.1.2",
"react-router-dom": "^4.3.1",
"react-sizeme": "^2.3.6",
"reactcss": "1.2.3",
Expand Down Expand Up @@ -283,6 +280,8 @@
"@microsoft/api-documenter": "7.4.3",
"@microsoft/api-extractor": "7.4.2",
"@percy/agent": "^0.11.0",
"@testing-library/react": "^9.3.2",
"@testing-library/react-hooks": "^3.2.1",
"@types/angular": "^1.6.56",
"@types/angular-mocks": "^1.7.0",
"@types/babel__core": "^7.1.2",
Expand All @@ -308,7 +307,7 @@
"@types/has-ansi": "^3.0.0",
"@types/history": "^4.7.3",
"@types/hoek": "^4.1.3",
"@types/jest": "^24.0.18",
"@types/jest": "24.0.19",
"@types/joi": "^13.4.2",
"@types/jquery": "^3.3.31",
"@types/js-yaml": "^3.11.1",
Expand All @@ -328,8 +327,8 @@
"@types/podium": "^1.0.0",
"@types/prop-types": "^15.5.3",
"@types/reach__router": "^1.2.6",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"@types/react-redux": "^6.0.6",
"@types/react-router-dom": "^4.3.1",
"@types/react-virtualized": "^9.18.7",
Expand All @@ -343,6 +342,8 @@
"@types/styled-components": "^4.4.0",
"@types/supertest": "^2.0.5",
"@types/supertest-as-promised": "^2.0.38",
"@types/testing-library__react": "^9.1.2",
"@types/testing-library__react-hooks": "^3.1.0",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
"@types/vinyl-fs": "^2.4.11",
Expand Down Expand Up @@ -405,7 +406,6 @@
"istanbul-instrumenter-loader": "3.0.1",
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"jest-dom": "^3.5.0",
"jest-raw-loader": "^1.0.1",
"jimp": "0.8.4",
"json5": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = {

rules: {
'block-scoped-var': 'error',
camelcase: [ 'error', { properties: 'never' } ],
camelcase: [ 'error', { properties: 'never', allow: ['^UNSAFE_'] } ],
'comma-dangle': 'off',
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': [ 'error', 'last' ],
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
rules: {
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'import/order': 'off'
'import/order': 'off',
},
}
]
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-kibana/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = {
'@typescript-eslint/camelcase': ['error', {
'properties': 'never',
'ignoreDestructuring': true,
'allow': ['^[A-Z0-9_]+$']
'allow': ['^[A-Z0-9_]+$', '^UNSAFE_']
}],
'@typescript-eslint/class-name-casing': 'error',
'@typescript-eslint/explicit-member-accessibility': ['error',
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"intl-messageformat": "^2.2.0",
"intl-relativeformat": "^2.1.0",
"prop-types": "^15.6.2",
"react": "^16.8.6",
"react": "^16.12.0",
"react-intl": "^2.8.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class GuideNav extends Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const currentRoute = nextProps.routes[1];
const nextRoute = this.props.getNextRoute(currentRoute.name);
const previousRoute = this.props.getPreviousRoute(currentRoute.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function mapDispatchToProps(dispatch) {
}

class GuideSandboxComponent extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
this.props.openSandbox();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class GuideSection extends Component {
this.props.openCodeViewer(this.props.source, this.props.title);
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.props.registerSection(this.getId(), this.props.title);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/doc_site/src/views/app_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AppView extends Component {
});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
// Only force the chrome to be hidden if we're navigating from a non-sandbox to a sandbox.
if (!this.props.isSandbox && nextProps.isSandbox) {
this.setState({
Expand Down
6 changes: 3 additions & 3 deletions packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"focus-trap-react": "^3.1.1",
"lodash": "npm:@elastic/[email protected]",
"prop-types": "15.6.0",
"react": "^16.8.6",
"react": "^16.12.0",
"react-ace": "^5.9.0",
"react-color": "^2.13.8",
"tabbable": "1.1.3",
Expand Down Expand Up @@ -57,8 +57,8 @@
"postcss": "^7.0.5",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"react-dom": "^16.8.6",
"react-redux": "^5.0.6",
"react-dom": "^16.12.0",
"react-redux": "^5.1.2",
"react-router": "^3.2.0",
"react-router-redux": "^4.0.8",
"redux": "3.7.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FieldSelectUi extends Component {
this.loadFields(this.state.indexPatternId);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.indexPatternId !== nextProps.indexPatternId) {
this.loadFields(nextProps.indexPatternId);
}
Expand Down
10 changes: 0 additions & 10 deletions src/legacy/core_plugins/kibana/public/discover/doc/doc.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ beforeEach(() => {
jest.clearAllMocks();
});

// Suppress warnings about "act" until we use React 16.9
/* eslint-disable no-console */
const originalError = console.error;
beforeAll(() => {
console.error = jest.fn();
});
afterAll(() => {
console.error = originalError;
});

export const waitForPromises = () => new Promise(resolve => setTimeout(resolve, 0));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
import { renderHook, act } from 'react-hooks-testing-library';
import { renderHook, act } from '@testing-library/react-hooks';
import { buildSearchBody, useEsDocSearch, ElasticRequestState } from './use_es_doc_search';
import { DocProps } from './doc';

// Suppress warnings about "act" until we use React 16.9
/* eslint-disable no-console */
const originalError = console.error;
beforeAll(() => {
console.error = jest.fn();
});
afterAll(() => {
console.error = originalError;
});

describe('Test of <Doc /> helper / hook', () => {
test('buildSearchBody', () => {
const indexPattern = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TutorialUi extends React.Component {
}
}

componentWillMount() {
UNSAFE_componentWillMount() {
this._isMounted = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class IndicesList extends Component {
this.pager = new Pager(props.indices.length, this.state.perPage, this.state.page);
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.indices.length !== this.props.indices.length) {
this.pager.setTotalItems(nextProps.indices.length);
this.resetPageTo0();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class StepIndexPattern extends Component {
this.lastQuery = null;
}

async componentWillMount() {
async UNSAFE_componentWillMount() {
this.fetchExistingIndexPatterns();
if (this.state.query) {
this.lastQuery = this.state.query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class CreateIndexPatternWizard extends Component {
};
}

async componentWillMount() {
async UNSAFE_componentWillMount() {
this.fetchData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class IndexedFieldsTable extends Component {
};
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.fields !== this.props.fields) {
this.setState({
fields: this.mapFields(nextProps.fields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ScriptedFieldsTable extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.fetchFields();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class SourceFiltersTable extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.updateFilters();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export class Relationships extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
this.getRelationshipData();
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.savedObject.id !== this.props.savedObject.id) {
this.getRelationshipData();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class AdvancedSettings extends Component {
}, {});
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const { config } = nextProps;
const { query } = this.state;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Field extends PureComponent {
this.changeImageForm = null;
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const { unsavedValue } = this.state;
const { type, value, defVal } = nextProps.setting;
const editableValue = this.getEditableValue(type, value, defVal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TelemetryForm extends Component {
queryMatches: null,
}

componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
const {
query
} = nextProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
} from '@elastic/eui';

export class CalculationAgg extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.variables) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
import { FormattedMessage } from '@kbn/i18n/react';

export class MathAgg extends Component {
componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.variables) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const RESTRICT_FIELDS = [KBN_FIELD_TYPES.NUMBER];
export class PercentileAgg extends Component {
// eslint-disable-line react/no-multi-comp

componentWillMount() {
UNSAFE_componentWillMount() {
if (!this.props.model.percentiles) {
this.props.onChange(
_.assign({}, this.props.model, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import PropTypes from 'prop-types';
import React, { Component } from 'react';
import React, { PureComponent } from 'react';

import {
ColorWrap as colorWrap,
Expand All @@ -32,18 +32,13 @@ import ChromePointer from 'react-color/lib/components/chrome/ChromePointer';
import ChromePointerCircle from 'react-color/lib/components/chrome/ChromePointerCircle';
import CompactColor from 'react-color/lib/components/compact/CompactColor';
import color from 'react-color/lib/helpers/color';
import shallowCompare from 'react-addons-shallow-compare';

class CustomColorPickerUI extends Component {
class CustomColorPickerUI extends PureComponent {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}

shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(nextProps, nextState);
}

handleChange(data) {
this.props.onChange(data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class GaugePanelConfigUi extends Component {
this.state = { selectedTab: 'data' };
}

componentWillMount() {
UNSAFE_componentWillMount() {
const { model } = this.props;
const parts = {};
if (
Expand Down
Loading