Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update to React v19 #1861

Merged
merged 3 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@canonical/jujulib": "7.0.0",
"@canonical/macaroon-bakery": "1.3.2",
"@canonical/react-components": "2.1.0",
"@canonical/rebac-admin": "0.0.1-alpha.9",
"@canonical/rebac-admin": "0.0.1-alpha.10",
"@reduxjs/toolkit": "2.5.1",
"@sentry/browser": "9.1.0",
"@sentry/core": "9.1.0",
Expand All @@ -69,14 +69,13 @@
"loglevel": "1.9.2",
"prism-react-renderer": "2.4.1",
"prismjs": "1.29.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-ga": "3.3.1",
"react-hot-toast": "2.5.1",
"react-json-tree": "0.19.0",
"react-redux": "9.2.0",
"react-router": "7.1.5",
"react-useportal": "1.0.19",
"redux": "5.0.1",
"vanilla-framework": "4.21.0",
"yup": "1.6.1"
Expand All @@ -94,8 +93,8 @@
"@types/lodash.mergewith": "4.6.9",
"@types/node": "20.10.0",
"@types/prismjs": "1.26.5",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3",
"@types/react-table": "7.7.20",
"@types/redux-mock-store": "1.5.0",
"@typescript-eslint/eslint-plugin": "8.24.0",
Expand Down Expand Up @@ -144,6 +143,8 @@
},
"packageManager": "[email protected]",
"resolutions": {
"anchorme": "^3.0.8"
"anchorme": "^3.0.8",
"react": "19.0.0",
"@types/react": "19.0.8"
}
}
2 changes: 1 addition & 1 deletion src/animations/FadeIn.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { motion, AnimatePresence } from "framer-motion";
import type { PropsWithChildren } from "react";
import type { JSX, PropsWithChildren } from "react";

type Props = {
className?: string;
Expand Down
1 change: 1 addition & 0 deletions src/animations/FadeUpIn.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { motion, AnimatePresence } from "framer-motion";
import type { JSX } from "react";

type Props = {
children: JSX.Element;
Expand Down
1 change: 1 addition & 0 deletions src/animations/SlideDownFadeOut.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { motion, AnimatePresence } from "framer-motion";
import type { JSX } from "react";

type Props = {
children: JSX.Element;
Expand Down
1 change: 1 addition & 0 deletions src/components/AppLink/AppLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from "react";
import { type PropsWithChildren } from "react";
import { Link } from "react-router";

Expand Down
1 change: 1 addition & 0 deletions src/components/Aside/Aside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
} from "@canonical/react-components";
import classnames from "classnames";
import { useAnimate, usePresence } from "framer-motion";
import type { JSX } from "react";
import { useEffect, type PropsWithChildren } from "react";

import "./_aside.scss";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Banner/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classnames from "classnames";
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";
import { useState, useEffect } from "react";

import "./_banner.scss";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumb/Breadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";
import { Link } from "react-router";

import { useEntityDetailsParams } from "components/hooks";
Expand Down
1 change: 1 addition & 0 deletions src/components/CaptureRoutes/CaptureRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from "react";
import { useEffect } from "react";
import { Outlet, useLocation } from "react-router";

Expand Down
3 changes: 2 additions & 1 deletion src/components/ConnectionError/ConnectionError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useEffect, type PropsWithChildren } from "react";
import reactHotToast from "react-hot-toast";

import ToastCard from "components/ToastCard";
import type { ToastInstance } from "components/ToastCard";
import { getConnectionError } from "store/general/selectors";
import { getAuditEventsErrors } from "store/juju/selectors";
import { useAppSelector } from "store/store";
Expand All @@ -23,7 +24,7 @@ const ConnectionError = ({ children }: PropsWithChildren) => {

useEffect(() => {
if (auditLogsErrors) {
reactHotToast.custom((t) => (
reactHotToast.custom((t: ToastInstance) => (
<ToastCard type="negative" toastInstance={t}>
{generateErrorContent(auditLogsErrors)}
</ToastCard>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContentReveal/ContentReveal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";
import { useState } from "react";

import "./_content-reveal.scss";
Expand Down
2 changes: 1 addition & 1 deletion src/components/EntityInfo/EntityInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";

import TruncatedTooltip from "components/TruncatedTooltip";

Expand Down
2 changes: 1 addition & 1 deletion src/components/FormikFormData/FormikFormData.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Form, useFormikContext } from "formik";
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";
import { useEffect } from "react";

import type { SetFieldValue } from "./types";
Expand Down
3 changes: 1 addition & 2 deletions src/components/InfoPanel/InfoPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Modal } from "@canonical/react-components";
import { usePortal, Modal } from "@canonical/react-components";
import { useSelector } from "react-redux";
import { useParams } from "react-router";
import usePortal from "react-useportal";

import type { EntityDetailsRoute } from "components/Routes";
import Topology from "components/Topology";
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingHandler/LoadingHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Spinner } from "@canonical/react-components";
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";

import "./_loading-handler.scss";
import { TestId } from "./types";
Expand Down
3 changes: 2 additions & 1 deletion src/components/LogIn/LogIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import FadeUpIn from "animations/FadeUpIn";
import AuthenticationButton from "components/AuthenticationButton";
import Logo from "components/Logo";
import ToastCard from "components/ToastCard";
import type { ToastInstance } from "components/ToastCard";
import {
getConfig,
getLoginError,
Expand Down Expand Up @@ -43,7 +44,7 @@ export default function LogIn() {
useEffect(() => {
visitURLs?.forEach((visitURL) => {
if (!viewedAuthRequests.current.includes(visitURL)) {
reactHotToast.custom((t) => (
reactHotToast.custom((t: ToastInstance) => (
<ToastCard toastInstance={t} type="caution">
<p className="u-no-margin--top u-no-padding--top">
Controller authentication required
Expand Down
1 change: 1 addition & 0 deletions src/components/MachineLink/MachineLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from "react";
import { type PropsWithChildren } from "react";
import { Link } from "react-router";

Expand Down
2 changes: 2 additions & 0 deletions src/components/NotFound/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from "react";

type Props = {
message: string;
children: JSX.Element;
Expand Down
1 change: 1 addition & 0 deletions src/components/Panel/Panel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import type { JSX } from "react";
import { vi } from "vitest";

import { usePanelQueryParams } from "panels/hooks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ exports[`OptionInputs > renders the supplied list of options 1`] = `
id="MyAction-fruit"
name="MyAction-fruit"
type="text"
value=""
/>
<span>
yum
Expand All @@ -37,7 +36,6 @@ exports[`OptionInputs > renders the supplied list of options 1`] = `
id="MyAction-veg"
name="MyAction-veg"
type="text"
value=""
/>
<span>
ehhh
Expand Down
2 changes: 1 addition & 1 deletion src/components/RadioInputBox/RadioInputBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ReactNode } from "react";
import type { JSX, ReactNode } from "react";
import { useEffect, useRef, useState } from "react";

import "./_radio-input-box.scss";
Expand Down
2 changes: 1 addition & 1 deletion src/components/SegmentedControl/SegmentedControl.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ButtonProps } from "@canonical/react-components";
import { Button, type PropsWithSpread } from "@canonical/react-components";
import classNames from "classnames";
import type { ComponentType, ElementType, HTMLProps } from "react";
import type { ComponentType, ElementType, HTMLProps, JSX } from "react";

type Props<P = ButtonProps> = PropsWithSpread<
{
Expand Down
6 changes: 4 additions & 2 deletions src/components/ToastCard/ToastCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Toaster } from "react-hot-toast";
import reactHotToast from "react-hot-toast";
import { vi } from "vitest";

import type { ToastInstance } from "components/ToastCard";

import ToastCard from "./ToastCard";

describe("Toast Card", () => {
Expand Down Expand Up @@ -112,7 +114,7 @@ describe("Toast Card", () => {
it("should remove the card when close is clicked", async () => {
render(<Toaster />);
await act(async () => {
reactHotToast.custom((t) => (
reactHotToast.custom((t: ToastInstance) => (
<ToastCard type="negative" toastInstance={t}>
I am a toast message
</ToastCard>
Expand All @@ -128,7 +130,7 @@ describe("Toast Card", () => {
it("should close the card using the keyboard", async () => {
render(<Toaster />);
await act(async () => {
reactHotToast.custom((t) => (
reactHotToast.custom((t: ToastInstance) => (
<ToastCard type="negative" toastInstance={t}>
I am a toast message
</ToastCard>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ToastCard/ToastCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import reactHotToast from "react-hot-toast";

import "./_toast-card.scss";

type ToastInstance = {
export type ToastInstance = {
createdAt: number;
duration?: number | undefined;
id: string;
Expand Down
1 change: 1 addition & 0 deletions src/components/ToastCard/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { default } from "./ToastCard";
export { type ToastInstance } from "./ToastCard";
1 change: 1 addition & 0 deletions src/components/UnitLink/UnitLink.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from "react";
import { type PropsWithChildren } from "react";
import { Link } from "react-router";

Expand Down
1 change: 1 addition & 0 deletions src/components/secrets/SecretForm/Fields/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Textarea,
} from "@canonical/react-components";
import { FieldArray, useFormikContext } from "formik";
import type { JSX } from "react";

import type { FormFields } from "../types";

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useLogout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { unwrapResult } from "@reduxjs/toolkit";
import reactHotToast from "react-hot-toast";

import ToastCard from "components/ToastCard";
import type { ToastInstance } from "components/ToastCard";
import { thunks as appThunks } from "store/app";
import { useAppDispatch } from "store/store";
import { logger } from "utils/logger";
Expand All @@ -17,7 +18,7 @@ const useLogout = () => {
dispatch(appThunks.logOut())
.then(unwrapResult)
.catch((error) => {
reactHotToast.custom((t) => (
reactHotToast.custom((t: ToastInstance) => (
<ToastCard toastInstance={t} type="negative">
<>
{Label.LOGOUT_ERROR} Try{" "}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/AdvancedSearch/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from "react";

import BaseLayout from "layout/BaseLayout/BaseLayout";

import ErrorsBlock from "./ErrorsBlock";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from "@canonical/react-components";
import { Highlight } from "prism-react-renderer";
import Prism from "prismjs/components/prism-core";
import type { JSX } from "react";
import { useState } from "react";
import { JSONTree } from "react-json-tree";
import "prismjs/components/prism-json";
Expand Down
1 change: 1 addition & 0 deletions src/pages/AdvancedSearch/ErrorsBlock/ErrorsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fastDeepEqual from "fast-deep-equal/es6";
import type { JSX } from "react";

import type { CrossModelQueryResponse } from "juju/jimm/JIMMV4";
import {
Expand Down
1 change: 1 addition & 0 deletions src/pages/AdvancedSearch/ResultsBlock/ResultsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Spinner } from "@canonical/react-components";
import type { JSX } from "react";
import { useEffect } from "react";

import { actions as jujuActions } from "store/juju";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { PropsWithSpread } from "@canonical/react-components";
import type { PropsWithChildren } from "react";
import type { JSX, PropsWithChildren } from "react";

import ModelDetailsLink from "components/ModelDetailsLink";
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button } from "@canonical/react-components";
import type { JSX } from "react";

type Props = {
handleQuery: (query: string) => Promise<void>;
Expand Down
1 change: 1 addition & 0 deletions src/pages/AdvancedSearch/SearchForm/SearchForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Button, Textarea } from "@canonical/react-components";
import type { FormikProps } from "formik";
import { Field, Form, Formik } from "formik";
import type { JSX } from "react";
import { useCallback, useEffect, useRef } from "react";

import { copyToClipboard } from "components/utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useFormikContext } from "formik";
import type { JSX } from "react";

import QueryLink from "../QueryLink";
import type { FormFields } from "../types";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ContextualMenu, Icon } from "@canonical/react-components";
import { useFormikContext } from "formik";
import type { JSX } from "react";

import { getCrossModelQueryLoading } from "store/juju/selectors";
import { useAppSelector } from "store/store";
Expand Down
4 changes: 2 additions & 2 deletions src/pages/EntityDetails/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, MainTable, Icon } from "@canonical/react-components";
import classNames from "classnames";
import { Field, Formik } from "formik";
import type { MouseEvent } from "react";
import type { JSX, MouseEvent } from "react";
import { useMemo, useRef, useState } from "react";
import { useSelector } from "react-redux";
import { Link, useParams } from "react-router";
Expand Down Expand Up @@ -56,7 +56,7 @@ export default function App(): JSX.Element {
useState<boolean>(false);

const tablesRef = useRef<HTMLDivElement>(null);
const setFieldsValues = useRef<SetFieldValue<FormData>>();
const setFieldsValues = useRef<SetFieldValue<FormData>>(null);
const selectedUnits = useRef<string[]>([]);
const selectAll = useRef<boolean>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
CodeSnippetBlockAppearance,
Modal,
} from "@canonical/react-components";
import type { JSX } from "react";

import { copyToClipboard } from "components/utils";

Expand Down
2 changes: 2 additions & 0 deletions src/pages/EntityDetails/Model/Logs/AuditLogs/AuditLogs.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from "react";

import AuditLogsTable from "components/AuditLogsTable";

const AuditLogs = (): JSX.Element => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
Tooltip,
ActionButton,
Notification,
usePortal,
} from "@canonical/react-components";
import { Form, Formik } from "formik";
import { useParams } from "react-router";
import usePortal from "react-useportal";

import type { EntityDetailsRoute } from "components/Routes";
import RevisionField from "components/secrets/RevisionField";
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Logs/Logs.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { JSX } from "react";

import ActionBar from "components/ActionBar";
import AuditLogsTable from "components/AuditLogsTable/AuditLogsTable";
import AuditLogsTableActions from "components/AuditLogsTable/AuditLogsTableActions";
Expand Down
Loading
Loading