Skip to content

Commit

Permalink
chore: Upgrade React 18 (SCE-1) (#1079)
Browse files Browse the repository at this point in the history
Co-authored-by: Timmy Huang <[email protected]>
  • Loading branch information
kaloster and tihuan authored Aug 28, 2024
1 parent a1555a7 commit 5607bf3
Show file tree
Hide file tree
Showing 24 changed files with 8,257 additions and 8,436 deletions.
2 changes: 1 addition & 1 deletion .infra/rdev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ stack:
services:
explorer:
image:
tag: sha-78bf2226
tag: sha-d6c2ebd2
replicaCount: 1
env:
# env vars common to all deployment stages
Expand Down
2 changes: 1 addition & 1 deletion client/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v20
20 changes: 15 additions & 5 deletions client/__tests__/e2e/cellxgeneActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,11 +752,21 @@ export async function addGeneToSearch(
geneName: string,
page: Page
): Promise<void> {
await page
.getByTestId(`gene-search`)
.getByPlaceholder("Quick Gene Search")
.fill(geneName);
await page.keyboard.press("Enter");
await tryUntil(
async () => {
await page
.getByTestId("gene-search")
.getByPlaceholder("Quick Gene Search")
.fill(geneName);
await expect(
page.getByTestId(`suggest-menu-item-${geneName}`)
).toBeVisible();
},
{ page }
);

await page.getByTestId(`suggest-menu-item-${geneName}`).click();

expect(page.getByTestId(`histogram-${geneName}`)).toBeTruthy();
}

Expand Down
1 change: 0 additions & 1 deletion client/__tests__/e2e/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,6 @@ for (const testDataset of testDatasets) {
coords: initialCoordinates,
page,
});

const newGraph = page.getByTestId("graph-wrapper");
const newDistance =
(await newGraph.getAttribute("data-camera-distance")) ?? "-1";
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16,418 changes: 8,153 additions & 8,265 deletions client/package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"engineStrict": true,
"engines": {
"npm": ">=3.0.0",
"node": ">=16"
"node": ">=20"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -85,9 +85,9 @@
"memoize-one": "^5.1.1",
"openseadragon": "^4.1.1",
"pako": "^2.0.3",
"react": "^17.0.2",
"react": "^18.3.1",
"react-async": "^10.0.1",
"react-dom": "^17.0.2",
"react-dom": "^18.3.1",
"react-flip-toolkit": "^7.0.12",
"react-icons": "^4.2.0",
"react-redux": "^7.2.0",
Expand Down Expand Up @@ -117,8 +117,8 @@
"@babel/register": "^7.13.16",
"@babel/runtime": "^7.13.16",
"@blueprintjs/eslint-plugin": "^0.3.0",
"@chromatic-com/playwright": "^0.5.3",
"@playwright/test": "^1.40.1",
"@chromatic-com/playwright": "^0.6.18",
"@playwright/test": "^1.46.1",
"@sentry/webpack-plugin": "^1.15.0",
"@storybook/addon-essentials": "^7.6.12",
"@storybook/addon-interactions": "^7.6.12",
Expand Down Expand Up @@ -147,8 +147,8 @@
"@types/node": "^20.10.6",
"@types/openseadragon": "^3.0.10",
"@types/pako": "^1.0.2",
"@types/react": "^17.0.14",
"@types/react-dom": "^17.0.9",
"@types/react": "^18.3.4",
"@types/react-dom": "^18.3.0",
"@types/react-redux": "^7.1.18",
"@types/sha1": "^1.1.3",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand All @@ -159,7 +159,7 @@
"browserslist-useragent-regexp": "^3.0.2",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.6",
"chromatic": "^10.7.1",
"chromatic": "^11.7.1",
"chromatic-playwright": "^0.4.1",
"clean-css": "^5.1.2",
"clean-webpack-plugin": "^4.0.0-alpha.0",
Expand Down Expand Up @@ -198,12 +198,12 @@
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"serve-favicon": "^2.5.0",
"storybook": "^7.6.12",
"storybook": "^8.2.9",
"terser-webpack-plugin": "^5.1.1",
"typescript": "^4.3.5",
"webpack": "^5.34.0",
"webpack-cli": "^4.6.0",
"webpack-dev-middleware": "^4.1.0",
"webpack-cli": "^5.1.4",
"webpack-dev-middleware": "^5.3.4",
"webpack-merge": "^5.0.9"
},
"babel": {
Expand Down
9 changes: 3 additions & 6 deletions client/src/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface HeaderProps {
tosURL?: string;
privacyURL?: string;
}
const Header = (props: HeaderProps) => {
function Header(props: HeaderProps) {
const { tosURL, privacyURL } = props;
return (
<Wrapper data-testid="header">
Expand Down Expand Up @@ -234,9 +234,6 @@ const Header = (props: HeaderProps) => {
function handleDEClick(): void {
track(EVENTS.DE_CLICK_NAV);
}
};
Header.defaultProps = {
tosURL: undefined,
privacyURL: undefined,
};
}

export default Header;
9 changes: 3 additions & 6 deletions client/src/components/brushableHistogram/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ interface StillLoadingProps {
/**
* Render a loading indicator for the field.
*/
const StillLoading = ({ height = 211 }: StillLoadingProps): JSX.Element => (
<div style={{ height }} className={SKELETON} />
);
StillLoading.defaultProps = {
height: 211,
};
function StillLoading({ height = 211 }: StillLoadingProps) {
return <div style={{ height }} className={SKELETON} />;
}

export default StillLoading;
64 changes: 0 additions & 64 deletions client/src/components/categorical/annoSelect.tsx

This file was deleted.

1 change: 1 addition & 0 deletions client/src/components/categorical/category/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ const CategoryHeader = React.memo(
alignItems: "flex-start",
}}
>
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control -- TODO: Need to separate expand and checkbox label */}
<label
className={`${Classes.CONTROL} ${Classes.CHECKBOX} ignore-capture`}
htmlFor={checkboxID}
Expand Down
23 changes: 9 additions & 14 deletions client/src/components/categorical/value/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { connect } from "react-redux";
import React from "react";
import * as d3 from "d3";
import { Classes } from "@blueprintjs/core";
import { Checkbox } from "@blueprintjs/core";
import * as globals from "../../../globals";
// @ts-expect-error ts-migrate(2307) FIXME: Cannot find module '../categorical.css' or its cor... Remove this comment to see the full error message
import styles from "../categorical.css";
Expand Down Expand Up @@ -601,26 +601,21 @@ class CategoryValue extends React.Component<Props, InternalStateProps> {
}}
>
<div style={{ display: "flex", alignItems: "baseline" }}>
<label
htmlFor={valueToggleLabel}
className={`${Classes.CONTROL} ${Classes.CHECKBOX} ignore-capture`}
style={{ margin: 0 }}
<span
className="ignore-capture"
style={{ margin: 0, height: "18px" }}
>
<input
<Checkbox
id={valueToggleLabel}
onChange={isSelected ? this.toggleOff : this.toggleOn}
data-testid={`categorical-value-select-${metadataField}-${displayString}`}
checked={isSelected}
type="checkbox"
/>
<span
className={Classes.CONTROL_INDICATOR}
onMouseEnter={this.handleMouseExit}
onMouseLeave={this.handleMouseEnter}
/>
</label>
</span>
<Truncate>
<span
<label
htmlFor={valueToggleLabel}
data-testid="categorical-value"
tabIndex={-1}
style={{
Expand All @@ -642,7 +637,7 @@ class CategoryValue extends React.Component<Props, InternalStateProps> {
}}
>
{displayString}
</span>
</label>
</Truncate>
{isCellInfo && (
<InfoButtonWrapper>
Expand Down
4 changes: 0 additions & 4 deletions client/src/components/controls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ function Controls(props: Props): JSX.Element {
);
}

Controls.defaultProps = {
bottom: undefined,
};

export default Controls;
16 changes: 7 additions & 9 deletions client/src/components/framework/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { Children, useState } from "react";
import React, { Children, ReactNode, useState } from "react";
import * as globals from "../../globals";

interface Props {
children: ReactNode;
addTopPadding: boolean;
renderGraph?: (viewport: HTMLDivElement) => React.ReactNode;
}
Expand All @@ -17,11 +18,10 @@ interface Props {
should be.
*/

const Layout: React.FC<Props> = (props) => {
function Layout({ children, addTopPadding, renderGraph = undefined }: Props) {
const [viewportRef, setViewportRef] = useState<HTMLDivElement | null>(null);

const { children, addTopPadding, renderGraph } = props;
const [leftSidebar, rightSidebar] = Children.toArray(children);
const [leftSidebar, rightSidebar, ...restChildren] =
Children.toArray(children);
let graphComponent = null;
if (viewportRef && renderGraph) {
graphComponent = renderGraph(viewportRef);
Expand Down Expand Up @@ -74,6 +74,7 @@ const Layout: React.FC<Props> = (props) => {
}}
>
{graphComponent}
{restChildren}
</div>
<div
style={{
Expand All @@ -88,9 +89,6 @@ const Layout: React.FC<Props> = (props) => {
</div>
</div>
);
};
}

Layout.defaultProps = {
renderGraph: undefined,
};
export default Layout;
40 changes: 12 additions & 28 deletions client/src/components/framework/layoutSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ import Layout from "./layout";
import LeftSidebarSkeleton from "../leftSidebar/leftSidebarSkeleton";
import RightSidebarSkeleton from "../rightSidebar/rightSidebarSkeleton";

/* Padding between dataset selector and menubar */
const PADDING_CONTROLS = 10;

/* Width of menubar */
const WIDTH_MENUBAR = 482;

/**
* Skeleton layout component displayed when in loading state.
* @returns Markup displaying skeleton.
Expand All @@ -22,29 +16,19 @@ function LayoutSkeleton(): JSX.Element {
return (
<Layout addTopPadding>
<LeftSidebarSkeleton />
{() => (
<Controls>
<div
style={{
height: 30,
position: "relative",
top: 8,
width: `calc(100% - ${WIDTH_MENUBAR}px - ${PADDING_CONTROLS}px)`,
}}
className={SKELETON}
/>
<div
style={{
height: 30,
position: "relative",
top: 8,
width: WIDTH_MENUBAR,
}}
className={SKELETON}
/>
</Controls>
)}
<RightSidebarSkeleton />
<Controls>
<div
style={{
height: 30,
position: "relative",
top: 8,
width: "100%",
}}
className={SKELETON}
data-testid="menubar-skeleton"
/>
</Controls>
</Layout>
);
}
Expand Down
Loading

0 comments on commit 5607bf3

Please sign in to comment.