Skip to content

Commit 24bfd18

Browse files
authored
chore: Upgrade to React 19 (#5220)
1 parent ac90f4b commit 24bfd18

9 files changed

Lines changed: 1201 additions & 1117 deletions

File tree

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@testing-library/user-event": "14.5.2",
4747
"@types/jest": "29.5.14",
4848
"@types/randomstring": "1.3.0",
49-
"@types/react": "18.3.18",
50-
"@types/react-dom": "18.3.5",
49+
"@types/react": "19.1.8",
50+
"@types/react-dom": "19.1.6",
5151
"@types/react-redux": "7.1.34",
5252
"@types/react-router-dom": "5.3.3",
5353
"@types/topojson-client": "3.1.5",
@@ -80,10 +80,10 @@
8080
"prop-types": "15.8.1",
8181
"randomstring": "1.3.0",
8282
"raven-js": "3.27.2",
83-
"react": "18.3.1",
83+
"react": "19.1.0",
8484
"react-dnd": "16.0.1",
8585
"react-dnd-html5-backend": "16.0.1",
86-
"react-dom": "18.3.1",
86+
"react-dom": "19.1.0",
8787
"react-hook-form": "7.54.2",
8888
"react-joyride": "3.0.0-7",
8989
"react-query": "3.39.3",
@@ -134,8 +134,6 @@
134134
"ts-jest": "29.2.5"
135135
},
136136
"resolutions": {
137-
"@types/react": "18.3.18",
138-
"@types/react-dom": "18.3.5",
139137
"lodash": "4.17.21"
140138
}
141139
}

static/js/publisher/components/SectionNav/SectionNav.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Link } from "react-router-dom";
22
import { Tabs } from "@canonical/react-components";
33

4+
import type { ElementType } from "react";
5+
46
type Props = {
57
activeTab: string;
68
snapName: string | undefined;
@@ -15,37 +17,37 @@ function SectionNav({ activeTab, snapName }: Props): React.JSX.Element {
1517
label: "Listing",
1618
active: activeTab === "listing" || !activeTab,
1719
to: `/${snapName}/listing`,
18-
component: Link,
20+
component: Link as ElementType,
1921
},
2022
{
2123
label: "Builds",
2224
active: activeTab === "builds",
2325
to: `/${snapName}/builds`,
24-
component: Link,
26+
component: Link as ElementType,
2527
},
2628
{
2729
label: "Releases",
2830
active: activeTab === "releases",
2931
to: `/${snapName}/releases`,
30-
component: Link,
32+
component: Link as ElementType,
3133
},
3234
{
3335
label: "Metrics",
3436
active: activeTab === "metrics",
3537
to: `/${snapName}/metrics`,
36-
component: Link,
38+
component: Link as ElementType,
3739
},
3840
{
3941
label: "Publicise",
4042
active: activeTab === "publicise",
4143
to: `/${snapName}/publicise`,
42-
component: Link,
44+
component: Link as ElementType,
4345
},
4446
{
4547
label: "Settings",
4648
active: activeTab === "settings",
4749
to: `/${snapName}/settings`,
48-
component: Link,
50+
component: Link as ElementType,
4951
},
5052
]}
5153
/>

static/js/publisher/components/Tour/Tour.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Props = {
1010
steps: {
1111
target: string;
1212
title: string;
13-
content: React.JSX.Element;
13+
content: React.ReactNode;
1414
disableBeacon?: boolean;
1515
}[];
1616
};

static/js/publisher/pages/Releases/components/releasesTable/droppableRow.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,19 @@ const ReleasesTableDroppableRow = (props: {
193193
{versionCountString}
194194
</small>
195195
</div>
196-
<div className="p-releases-table__row--container" ref={drop}>
197-
<ReleasesTableChannelRow
198-
risk={risk}
199-
branch={branch}
200-
// @ts-ignore
201-
revisions={revisions}
202-
isOverParent={isOver}
203-
draggedItem={item}
204-
canDrop={canDrop}
205-
/>
206-
</div>
196+
{drop(
197+
<div className="p-releases-table__row--container">
198+
<ReleasesTableChannelRow
199+
risk={risk}
200+
branch={branch}
201+
// @ts-ignore
202+
revisions={revisions}
203+
isOverParent={isOver}
204+
draggedItem={item}
205+
canDrop={canDrop}
206+
/>
207+
</div>,
208+
)}
207209
</>
208210
);
209211
};

static/js/store/components/Banner/Banner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { SearchInput } from "../SearchInput";
44
import type { RefObject } from "react";
55

66
type Props = {
7-
searchRef: RefObject<HTMLInputElement>;
8-
searchSummaryRef?: RefObject<HTMLDivElement>;
7+
searchRef: RefObject<HTMLInputElement | null>;
8+
searchSummaryRef?: RefObject<HTMLDivElement | null>;
99
};
1010

1111
function Banner({ searchRef, searchSummaryRef }: Props): React.JSX.Element {

static/js/store/components/PackageList/PackageList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ function PackageList({
2323
}: {
2424
data?: Packages;
2525
isFetching: boolean;
26-
searchRef: RefObject<HTMLInputElement>;
27-
searchSummaryRef: RefObject<HTMLDivElement>;
26+
searchRef: RefObject<HTMLInputElement | null>;
27+
searchSummaryRef: RefObject<HTMLDivElement | null>;
2828
}): React.JSX.Element {
2929
const [searchParams, setSearchParams] = useSearchParams();
3030

static/js/store/components/SearchInput/SearchInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { useSearchParams } from "react-router-dom";
44
import type { RefObject } from "react";
55

66
type Props = {
7-
searchRef: RefObject<HTMLInputElement>;
8-
searchSummaryRef?: RefObject<HTMLDivElement>;
7+
searchRef: RefObject<HTMLInputElement | null>;
8+
searchSummaryRef?: RefObject<HTMLDivElement | null>;
99
};
1010

1111
export const SearchInput = ({

static/js/store/pages/Store/__tests__/Store.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import "@testing-library/jest-dom";
66

77
import Store from "../Store";
88

9+
// Necessary to prevent FormData type error in some tests
10+
global.FormData = jest.fn();
11+
912
global.fetch = jest.fn(() => {
1013
return Promise.resolve({
1114
json: () => {

0 commit comments

Comments
 (0)