From 06e7a48aaf02ce7fca03206b6593d11fb50d7de6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Aug 2019 15:31:33 +0100 Subject: [PATCH] Switch to React 16.8 Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- package.json | 9 ++++----- src/components/views/auth/VectorAuthFooter.js | 7 +++---- .../views/auth/VectorCustomServerDialog.js | 5 +++-- src/vector/index.js | 3 --- test/app-tests/joining.js | 2 +- test/app-tests/loading.js | 2 +- webpack.config.js | 1 - yarn.lock | 17 ++--------------- 8 files changed, 14 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 43b16416..7173e1fa 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "babel-runtime": "^6.26.0", "bluebird": "^3.5.2", "browser-request": "^0.3.3", + "create-react-class": "^15.6.0", "draft-js": "^0.11.0-alpha", "extract-text-webpack-plugin": "^4.0.0-beta.0", "favico.js": "^0.3.10", @@ -78,9 +79,9 @@ "matrix-react-sdk": "1.4.0", "modernizr": "^3.6.0", "olm": "https://packages.matrix.org/npm/olm/olm-3.1.0.tgz", - "prop-types": "^15.6.2", - "react": "^15.6.0", - "react-dom": "^15.6.0", + "prop-types": "^15.7.2", + "react": "^16.8.6", + "react-dom": "^16.8.6", "sanitize-html": "^1.19.1", "ua-parser-js": "^0.7.19", "url": "^0.11.0" @@ -144,8 +145,6 @@ "postcss-scss": "^1.0.6", "postcss-simple-vars": "^4.1.0", "postcss-strip-inline-comments": "^0.1.5", - "react-addons-perf": "^15.4.0", - "react-addons-test-utils": "^15.6.0", "rimraf": "^2.4.3", "source-map-loader": "^0.2.4", "webpack": "^4.23.1", diff --git a/src/components/views/auth/VectorAuthFooter.js b/src/components/views/auth/VectorAuthFooter.js index 46063133..fd409790 100644 --- a/src/components/views/auth/VectorAuthFooter.js +++ b/src/components/views/auth/VectorAuthFooter.js @@ -15,14 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - -const React = require('react'); +import React from 'react'; +import createReactClass from 'create-react-class'; import SdkConfig from 'matrix-react-sdk/lib/SdkConfig'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'VectorAuthFooter', statics: { replaces: 'AuthFooter', diff --git a/src/components/views/auth/VectorCustomServerDialog.js b/src/components/views/auth/VectorCustomServerDialog.js index b817cc3f..f9593218 100644 --- a/src/components/views/auth/VectorCustomServerDialog.js +++ b/src/components/views/auth/VectorCustomServerDialog.js @@ -15,14 +15,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -const React = require("react"); +import React from "react"; +import createReactClass from 'create-react-class'; import { _t } from 'matrix-react-sdk/lib/languageHandler'; /** * This is identical to `CustomServerDialog` except for replacing "this app" * with "Riot". */ -module.exports = React.createClass({ +module.exports = createReactClass({ displayName: 'VectorCustomServerDialog', statics: { replaces: 'CustomServerDialog', diff --git a/src/vector/index.js b/src/vector/index.js index 52379257..46b45bc5 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -33,9 +33,6 @@ import React from 'react'; // add React and ReactPerf to the global namespace, to make them easier to // access via the console global.React = React; -if (process.env.NODE_ENV !== 'production') { - global.Perf = require('react-addons-perf'); -} import './modernizr'; import ReactDOM from 'react-dom'; diff --git a/test/app-tests/joining.js b/test/app-tests/joining.js index 048f6d3c..9c546399 100644 --- a/test/app-tests/joining.js +++ b/test/app-tests/joining.js @@ -34,7 +34,7 @@ const RoomView = sdk.getComponent('structures.RoomView'); const React = require('react'); const ReactDOM = require('react-dom'); -const ReactTestUtils = require('react-addons-test-utils'); +const ReactTestUtils = require('react-dom/test-utils'); const expect = require('expect'); import Promise from 'bluebird'; import {makeType} from "matrix-react-sdk/lib/utils/TypeUtils"; diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index 6bf8341e..92549893 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -23,7 +23,7 @@ import 'skin-sdk'; import React from 'react'; import ReactDOM from 'react-dom'; -import ReactTestUtils from 'react-addons-test-utils'; +import ReactTestUtils from 'react-dom/test-utils'; import expect from 'expect'; import Promise from 'bluebird'; import MatrixReactTestUtils from 'matrix-react-test-utils'; diff --git a/webpack.config.js b/webpack.config.js index 3bb08cb3..fb16098c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -152,7 +152,6 @@ module.exports = { // using `npm link` / `yarn link`. "react": path.resolve('./node_modules/react'), "react-dom": path.resolve('./node_modules/react-dom'), - "react-addons-perf": path.resolve('./node_modules/react-addons-perf'), // same goes for js-sdk "matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'), diff --git a/yarn.lock b/yarn.lock index 7bcc5b96..30cb7f36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7396,19 +7396,6 @@ react-addons-css-transition-group@15.3.2: resolved "https://registry.yarnpkg.com/react-addons-css-transition-group/-/react-addons-css-transition-group-15.3.2.tgz#d8fa52bec9bb61bdfde8b9e4652b80297cbff667" integrity sha1-2PpSvsm7Yb396LnkZSuAKXy/9mc= -react-addons-perf@^15.4.0: - version "15.4.2" - resolved "https://registry.yarnpkg.com/react-addons-perf/-/react-addons-perf-15.4.2.tgz#110bdcf5c459c4f77cb85ed634bcd3397536383b" - integrity sha1-EQvc9cRZxPd8uF7WNLzTOXU2ODs= - dependencies: - fbjs "^0.8.4" - object-assign "^4.1.0" - -react-addons-test-utils@^15.6.0: - version "15.6.2" - resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.6.2.tgz#c12b6efdc2247c10da7b8770d185080a7b047156" - integrity sha1-wStu/cIkfBDae4dw0YUICnsEcVY= - react-beautiful-dnd@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/react-beautiful-dnd/-/react-beautiful-dnd-4.0.1.tgz#3b0a49bf6be75af351176c904f012611dd292b81" @@ -7435,7 +7422,7 @@ react-dom@^15.6.0, react-dom@^15.6.1: object-assign "^4.1.0" prop-types "^15.5.10" -react-dom@^16.4.2: +react-dom@^16.4.2, react-dom@^16.8.6: version "16.8.6" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.8.6.tgz#71d6303f631e8b0097f56165ef608f051ff6e10f" integrity sha512-1nL7PIq9LTL3fthPqwkvr2zY7phIPjYrT0jp4HjyEQrEROnw4dG41VVwi/wfoCneoleqrNX7iAD+pXebJZwrwA== @@ -7499,7 +7486,7 @@ react@^15.6.0, react@^15.6.1: object-assign "^4.1.0" prop-types "^15.5.10" -react@^16.4.2: +react@^16.4.2, react@^16.8.6: version "16.8.6" resolved "https://registry.yarnpkg.com/react/-/react-16.8.6.tgz#ad6c3a9614fd3a4e9ef51117f54d888da01f2bbe" integrity sha512-pC0uMkhLaHm11ZSJULfOBqV4tIZkx87ZLvbbQYunNixAAvjnC+snJCg0XQXn9VIsttVsbZP/H/ewzgsd5fxKXw==