Skip to content

Commit

Permalink
[v4] remove React 15 support (#4545)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya committed Sep 29, 2021
1 parent 6b6151d commit 9265bc4
Show file tree
Hide file tree
Showing 78 changed files with 36 additions and 361 deletions.
52 changes: 5 additions & 47 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
docker: *docker-node-browsers
environment:
JUNIT_REPORT_PATH: reports
parallelism: 6
parallelism: 7
steps:
- checkout
- restore_cache: *restore-node-modules-cache
Expand All @@ -147,36 +147,10 @@ jobs:
0) yarn lerna run --parallel test:typeCheck ;; \
1) yarn lerna run --scope "@blueprintjs/core" test:karma ;; \
2) yarn lerna run --scope "@blueprintjs/datetime" test:karma ;; \
3) yarn lerna run --scope "@blueprintjs/select" test:karma ;; \
4) yarn lerna run --scope "@blueprintjs/table" test:karma ;; \
5) yarn lerna run --scope "@blueprintjs/timezone" test:karma ;; \
esac
when: always
- store_test_results: { path: ./reports }
- store_artifacts: { path: ./reports }

test-react-15:
# copy test-react-16 and override environment
<<: *test-react
environment:
JUNIT_REPORT_PATH: reports
REACT: 15 # use React 15 for this job

test-react-16-only:
# test packages which only work with React 16
docker: *docker-node-browsers
environment:
JUNIT_REPORT_PATH: reports
parallelism: 1
steps:
- checkout
- restore_cache: *restore-node-modules-cache
- attach_workspace: { at: "." }
- run: mkdir ./reports
- run:
command: |
case $CIRCLE_NODE_INDEX in \
0) yarn lerna run --scope "@blueprintjs/popover2" test:karma ;; \
3) yarn lerna run --scope "@blueprintjs/popover2" test:karma ;; \
4) yarn lerna run --scope "@blueprintjs/select" test:karma ;; \
5) yarn lerna run --scope "@blueprintjs/table" test:karma ;; \
6) yarn lerna run --scope "@blueprintjs/timezone" test:karma ;; \
esac
when: always
- store_test_results: { path: ./reports }
Expand All @@ -195,13 +169,6 @@ jobs:
- store_test_results: { path: ./reports }
- store_artifacts: { path: ./reports }

test-iso-react-15:
# copy test-iso-react-16 and override environment
<<: *test-iso
environment:
JUNIT_REPORT_PATH: reports
REACT: 15 # use React 15 for this job

deploy-preview:
docker: *docker-node-lts
steps:
Expand Down Expand Up @@ -241,14 +208,8 @@ workflows:
requires: [compile]
- test-node-libs:
requires: [compile]
- test-react-15:
requires: [compile]
- test-react-16:
requires: [compile]
- test-react-16-only:
requires: [compile]
- test-iso-react-15:
requires: [compile]
- test-iso-react-16:
requires: [compile]
- deploy-preview:
Expand All @@ -259,10 +220,7 @@ workflows:
dist,
lint,
test-node-libs,
test-react-15,
test-react-16,
test-react-16-only,
test-iso-react-15,
test-iso-react-16,
]
filters:
Expand Down
7 changes: 3 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@
"dom4": "^2.1.5",
"normalize.css": "^8.0.1",
"popper.js": "^1.16.1",
"react-lifecycles-compat": "^3.0.4",
"react-popper": "^1.3.7",
"react-transition-group": "^2.9.0",
"react-transition-group": "^4.4.1",
"resize-observer-polyfill": "^1.5.1",
"tslib": "~1.13.0"
},
"peerDependencies": {
"react": "^15.3.0 || 16 || 17",
"react-dom": "^15.3.0 || 16 || 17"
"react": "^16.8 || 17",
"react-dom": "^16.8 || 17"
},
"devDependencies": {
"@blueprintjs/karma-build-scripts": "^2.0.2",
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/common/utils/reactUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,3 @@ export function isElementOfType<P = {}>(
export function createReactRef<T>() {
return typeof React.createRef !== "undefined" ? React.createRef<T>() : { current: null };
}

/**
* Replacement type for { polyfill } from "react-lifecycles-compat" useful in some places where
* the correct type is not inferred automatically. This should be removed once Blueprint depends on React >= 16.
* HACKHACK part of https://github.com/palantir/blueprint/issues/4342
*
* @deprecated use React 16
*/
export type LifecycleCompatPolyfill<P, T extends React.ComponentClass<P>> = (Comp: T) => T & { [K in keyof T]: T[K] };
2 changes: 0 additions & 2 deletions packages/core/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes, DISPLAYNAME_PREFIX, Intent, Props, MaybeElement } from "../../common";
import {
Expand Down Expand Up @@ -133,7 +132,6 @@ export interface IAlertProps extends IOverlayLifecycleProps, Props {
onClose?(confirmed: boolean, evt?: React.SyntheticEvent<HTMLElement>): void;
}

@polyfill
export class Alert extends AbstractPureComponent2<AlertProps> {
public static defaultProps: AlertProps = {
canEscapeKeyCancel: false,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/breadcrumbs/breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Boundary, Classes, Props, Position, removeNonHTMLProps } from "../../common";
import { Menu } from "../menu/menu";
Expand Down Expand Up @@ -80,7 +79,6 @@ export interface IBreadcrumbsProps extends Props {
popoverProps?: IPopoverProps;
}

@polyfill
export class Breadcrumbs extends AbstractPureComponent2<BreadcrumbsProps> {
public static defaultProps: Partial<BreadcrumbsProps> = {
collapseFrom: Boundary.START,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/button/buttonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Alignment, Classes } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
Expand Down Expand Up @@ -64,7 +63,7 @@ export interface IButtonGroupProps extends Props, HTMLDivProps {

// this component is simple enough that tests would be purely tautological.
/* istanbul ignore next */
@polyfill

export class ButtonGroup extends AbstractPureComponent2<ButtonGroupProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.ButtonGroup`;

Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/components/callout/callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import {
AbstractPureComponent2,
Expand Down Expand Up @@ -61,8 +60,6 @@ export interface ICalloutProps extends IntentProps, Props, HTMLDivProps {
title?: string;
}

/** This component supports the full range of HTML `<div>` props. */
@polyfill
export class Callout extends AbstractPureComponent2<CalloutProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Callout`;

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/card/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes, Elevation } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
Expand Down Expand Up @@ -52,7 +51,6 @@ export interface ICardProps extends Props, HTMLDivProps {
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
}

@polyfill
export class Card extends AbstractPureComponent2<CardProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Card`;

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/collapse/collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes } from "../../common";
import { DISPLAYNAME_PREFIX, Props } from "../../common/props";
Expand Down Expand Up @@ -117,7 +116,6 @@ export enum AnimationStates {
CLOSED,
}

@polyfill
export class Collapse extends AbstractPureComponent2<CollapseProps, ICollapseState> {
public static displayName = `${DISPLAYNAME_PREFIX}.Collapse`;

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/context-menu/contextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import classNames from "classnames";
import * as React from "react";
import * as ReactDOM from "react-dom";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes, Position } from "../../common";
import { IOverlayLifecycleProps } from "../overlay/overlay";
Expand Down Expand Up @@ -46,7 +45,7 @@ type IContextMenuProps = IOverlayLifecycleProps;

/* istanbul ignore next */
/** @deprecated use ContextMenu2 */
@polyfill

class ContextMenu extends AbstractPureComponent2<IContextMenuProps, IContextMenuState> {
public state: IContextMenuState = {
isDarkTheme: false,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes } from "../../common";
import * as Errors from "../../common/errors";
Expand Down Expand Up @@ -92,7 +91,6 @@ export interface IDialogProps extends OverlayableProps, IBackdropProps, Props {
"aria-describedby"?: string;
}

@polyfill
export class Dialog extends AbstractPureComponent2<DialogProps> {
public static defaultProps: DialogProps = {
canOutsideClickClose: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/dialog/dialogStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
Expand Down Expand Up @@ -60,7 +59,6 @@ export interface IDialogStepProps extends Props, Omit<HTMLDivProps, "id" | "titl
nextButtonProps?: DialogStepButtonProps;
}

@polyfill
export class DialogStep extends AbstractPureComponent2<DialogStepProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.DialogStep`;

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/dialog/multistepDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes, Utils } from "../../common";
import { DISPLAYNAME_PREFIX } from "../../common/props";
Expand Down Expand Up @@ -79,7 +78,6 @@ const PADDING_BOTTOM = 0;

const MIN_WIDTH = 800;

@polyfill
export class MultistepDialog extends AbstractPureComponent2<MultistepDialogProps, IMultistepDialogState> {
public static displayName = `${DISPLAYNAME_PREFIX}.MultistepDialog`;

Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/divider/divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2 } from "../../common";
import { DIVIDER } from "../../common/classes";
Expand All @@ -33,7 +32,7 @@ export interface IDividerProps extends Props, React.HTMLAttributes<HTMLElement>

// this component is simple enough that tests would be purely tautological.
/* istanbul ignore next */
@polyfill

export class Divider extends AbstractPureComponent2<IDividerProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Divider`;

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes } from "../../common";
import * as Errors from "../../common/errors";
Expand Down Expand Up @@ -108,7 +107,6 @@ export interface IDrawerProps extends OverlayableProps, IBackdropProps, Props {
vertical?: boolean;
}

@polyfill
export class Drawer extends AbstractPureComponent2<DrawerProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Drawer`;

Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/editable-text/editableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes, Keys } from "../../common";
import { DISPLAYNAME_PREFIX, IntentProps, Props } from "../../common/props";
Expand Down Expand Up @@ -145,7 +144,6 @@ export interface IEditableTextState {
const BUFFER_WIDTH_DEFAULT = 5;
const BUFFER_WIDTH_IE = 30;

@polyfill
export class EditableText extends AbstractPureComponent2<EditableTextProps, IEditableTextState> {
public static displayName = `${DISPLAYNAME_PREFIX}.EditableText`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { DISPLAYNAME_PREFIX } from "../../common/props";

Expand Down Expand Up @@ -64,7 +63,7 @@ export interface IAsyncControllableInputState {
*
* Note: this component does not apply any Blueprint-specific styling.
*/
@polyfill

export class AsyncControllableInput extends React.PureComponent<
IAsyncControllableInputProps,
IAsyncControllableInputState
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/forms/controlGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Classes } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLDivProps, Props } from "../../common/props";
Expand All @@ -42,7 +41,6 @@ export interface IControlGroupProps extends Props, HTMLDivProps {

// this component is simple enough that tests would be purely tautological.
/* istanbul ignore next */
@polyfill
export class ControlGroup extends AbstractPureComponent2<ControlGroupProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.ControlGroup`;

Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/components/forms/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import classNames from "classnames";
import * as React from "react";
import { polyfill } from "react-lifecycles-compat";

import { AbstractPureComponent2, Alignment, Classes, IRef, refHandler, setRef } from "../../common";
import { DISPLAYNAME_PREFIX, HTMLInputProps, Props } from "../../common/props";
Expand Down Expand Up @@ -164,7 +163,6 @@ export interface ISwitchProps extends ControlProps {
innerLabel?: string;
}

@polyfill
export class Switch extends AbstractPureComponent2<SwitchProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Switch`;

Expand Down Expand Up @@ -203,7 +201,6 @@ export type IRadioProps = ControlProps;
// eslint-disable-next-line deprecation/deprecation
export type RadioProps = IRadioProps;

@polyfill
export class Radio extends AbstractPureComponent2<RadioProps> {
public static displayName = `${DISPLAYNAME_PREFIX}.Radio`;

Expand Down Expand Up @@ -239,7 +236,6 @@ export interface ICheckboxState {
indeterminate: boolean;
}

@polyfill
export class Checkbox extends AbstractPureComponent2<CheckboxProps, ICheckboxState> {
public static displayName = `${DISPLAYNAME_PREFIX}.Checkbox`;

Expand Down
Loading

0 comments on commit 9265bc4

Please sign in to comment.