From 7d64842cea4cfe40bc1c37c131ebd5671ef3c070 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 11 May 2020 10:05:54 -0600 Subject: [PATCH] Revert "perf: Use PureComponent to avoid useless re-renders (#7258)" (#7328) This reverts commit bfe0d2ba49fa113b1ec0814cf399eb207142b512. --- packages/react-router-dom/modules/BrowserRouter.js | 2 +- packages/react-router-dom/modules/HashRouter.js | 2 +- packages/react-router-native/BackButton.js | 2 +- packages/react-router-native/DeepLinking.js | 2 +- packages/react-router-native/Link.js | 2 +- packages/react-router-native/experimental/StackRoute.js | 2 +- packages/react-router-native/experimental/TabRoutes.js | 4 ++-- packages/react-router-native/index.android.js | 2 +- packages/react-router/modules/Lifecycle.js | 2 +- packages/react-router/modules/MemoryRouter.js | 2 +- packages/react-router/modules/Route.js | 2 +- packages/react-router/modules/Router.js | 2 +- packages/react-router/modules/StaticRouter.js | 2 +- packages/react-router/modules/Switch.js | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/react-router-dom/modules/BrowserRouter.js b/packages/react-router-dom/modules/BrowserRouter.js index c502fafde3..9ae0e74421 100644 --- a/packages/react-router-dom/modules/BrowserRouter.js +++ b/packages/react-router-dom/modules/BrowserRouter.js @@ -7,7 +7,7 @@ import warning from "tiny-warning"; /** * The public API for a that uses HTML5 history. */ -class BrowserRouter extends React.PureComponent { +class BrowserRouter extends React.Component { history = createHistory(this.props); render() { diff --git a/packages/react-router-dom/modules/HashRouter.js b/packages/react-router-dom/modules/HashRouter.js index f92027d1ee..8a5bd7191e 100644 --- a/packages/react-router-dom/modules/HashRouter.js +++ b/packages/react-router-dom/modules/HashRouter.js @@ -7,7 +7,7 @@ import warning from "tiny-warning"; /** * The public API for a that uses window.location.hash. */ -class HashRouter extends React.PureComponent { +class HashRouter extends React.Component { history = createHistory(this.props); render() { diff --git a/packages/react-router-native/BackButton.js b/packages/react-router-native/BackButton.js index 6880a95ee6..4aa7f95d63 100644 --- a/packages/react-router-native/BackButton.js +++ b/packages/react-router-native/BackButton.js @@ -3,7 +3,7 @@ import { BackHandler } from "react-native"; import { __HistoryContext as HistoryContext } from "react-router"; -class BackButton extends React.PureComponent { +class BackButton extends React.Component { handleBack = () => { if (this.history.index === 0) { return false; // home screen diff --git a/packages/react-router-native/DeepLinking.js b/packages/react-router-native/DeepLinking.js index 0c578b4e62..a80d9d5aed 100644 --- a/packages/react-router-native/DeepLinking.js +++ b/packages/react-router-native/DeepLinking.js @@ -5,7 +5,7 @@ import { __HistoryContext as HistoryContext } from "react-router"; const protocolAndSlashes = /.*?:\/\//g; -class DeepLinking extends React.PureComponent { +class DeepLinking extends React.Component { push(url) { const pathname = url.replace(protocolAndSlashes, ""); this.history.push(pathname); diff --git a/packages/react-router-native/Link.js b/packages/react-router-native/Link.js index c3d2e25133..ba82d53fab 100644 --- a/packages/react-router-native/Link.js +++ b/packages/react-router-native/Link.js @@ -4,7 +4,7 @@ import PropTypes from "prop-types"; import { __HistoryContext as HistoryContext } from "react-router"; -export default class Link extends React.PureComponent { +export default class Link extends React.Component { static defaultProps = { component: TouchableHighlight, replace: false diff --git a/packages/react-router-native/experimental/StackRoute.js b/packages/react-router-native/experimental/StackRoute.js index 2ab9b5aef1..591d781b63 100644 --- a/packages/react-router-native/experimental/StackRoute.js +++ b/packages/react-router-native/experimental/StackRoute.js @@ -76,7 +76,7 @@ const PARENT_TRAVEL_DISTANCE = 100; const PARENT_FINAL_OPACITY = 0.25; const CARD_SHADOW_RADIUS = 10; -class AnimatedStack extends React.PureComponent { +class AnimatedStack extends React.Component { static propTypes = { title: PropTypes.any, content: PropTypes.any, diff --git a/packages/react-router-native/experimental/TabRoutes.js b/packages/react-router-native/experimental/TabRoutes.js index 1a64913802..c41d92bd62 100644 --- a/packages/react-router-native/experimental/TabRoutes.js +++ b/packages/react-router-native/experimental/TabRoutes.js @@ -4,7 +4,7 @@ import { View } from "react-native"; import Link from "../Link.js"; -export class TabRoutes extends React.PureComponent { +export class TabRoutes extends React.Component { render() { const { children } = this.props; return ( @@ -36,7 +36,7 @@ export class TabRoutes extends React.PureComponent { } } -export class TabRoute extends React.PureComponent { +export class TabRoute extends React.Component { render() { const { renderContent, path } = this.props; return ; diff --git a/packages/react-router-native/index.android.js b/packages/react-router-native/index.android.js index 927f346a19..f0b206de4a 100644 --- a/packages/react-router-native/index.android.js +++ b/packages/react-router-native/index.android.js @@ -10,7 +10,7 @@ import { Prompt } from "react-router-native"; -class ReactRouterNative extends React.PureComponent { +class ReactRouterNative extends React.Component { render() { return ( diff --git a/packages/react-router/modules/Lifecycle.js b/packages/react-router/modules/Lifecycle.js index 292d3dab21..a672c0ed13 100644 --- a/packages/react-router/modules/Lifecycle.js +++ b/packages/react-router/modules/Lifecycle.js @@ -1,6 +1,6 @@ import React from "react"; -class Lifecycle extends React.PureComponent { +class Lifecycle extends React.Component { componentDidMount() { if (this.props.onMount) this.props.onMount.call(this, this); } diff --git a/packages/react-router/modules/MemoryRouter.js b/packages/react-router/modules/MemoryRouter.js index 2f7b0c247c..22f337f83d 100644 --- a/packages/react-router/modules/MemoryRouter.js +++ b/packages/react-router/modules/MemoryRouter.js @@ -8,7 +8,7 @@ import Router from "./Router.js"; /** * The public API for a that stores location in memory. */ -class MemoryRouter extends React.PureComponent { +class MemoryRouter extends React.Component { history = createHistory(this.props); render() { diff --git a/packages/react-router/modules/Route.js b/packages/react-router/modules/Route.js index 85d024db8e..b35fae617e 100644 --- a/packages/react-router/modules/Route.js +++ b/packages/react-router/modules/Route.js @@ -27,7 +27,7 @@ function evalChildrenDev(children, props, path) { /** * The public API for matching a single path and rendering. */ -class Route extends React.PureComponent { +class Route extends React.Component { render() { return ( diff --git a/packages/react-router/modules/Router.js b/packages/react-router/modules/Router.js index 828d6f9012..bf87ad2a29 100644 --- a/packages/react-router/modules/Router.js +++ b/packages/react-router/modules/Router.js @@ -8,7 +8,7 @@ import RouterContext from "./RouterContext.js"; /** * The public API for putting history on context. */ -class Router extends React.PureComponent { +class Router extends React.Component { static computeRootMatch(pathname) { return { path: "/", url: "/", params: {}, isExact: pathname === "/" }; } diff --git a/packages/react-router/modules/StaticRouter.js b/packages/react-router/modules/StaticRouter.js index a72707e837..4edafaad25 100644 --- a/packages/react-router/modules/StaticRouter.js +++ b/packages/react-router/modules/StaticRouter.js @@ -50,7 +50,7 @@ function noop() {} * location changes in a context object. Useful mainly in testing and * server-rendering scenarios. */ -class StaticRouter extends React.PureComponent { +class StaticRouter extends React.Component { navigateTo(location, action) { const { basename = "", context = {} } = this.props; context.action = action; diff --git a/packages/react-router/modules/Switch.js b/packages/react-router/modules/Switch.js index c89f6cb753..30332768b2 100644 --- a/packages/react-router/modules/Switch.js +++ b/packages/react-router/modules/Switch.js @@ -9,7 +9,7 @@ import matchPath from "./matchPath.js"; /** * The public API for rendering the first that matches. */ -class Switch extends React.PureComponent { +class Switch extends React.Component { render() { return (