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

Upgrade to react-router v7 #1416

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Prev Previous commit
Next Next commit
Update imports from react-router-dom
divergentdave committed Nov 25, 2024
commit 42389963e1de82aba38aabd060009f29d939358e
2 changes: 1 addition & 1 deletion app/src/accounts/AccountForm.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import Button from "react-bootstrap/Button";
import FormGroup from "react-bootstrap/FormGroup";
import FormLabel from "react-bootstrap/FormLabel";
import FormControl from "react-bootstrap/FormControl";
import { Form } from "react-router-dom";
import { Form } from "react-router";
import { BuildingAdd } from "react-bootstrap-icons";

export default function AccountForm() {
2 changes: 1 addition & 1 deletion app/src/accounts/AccountList.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import Container from "react-bootstrap/Container";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
import React from "react";
import { useLoaderData, useAsyncValue, Await } from "react-router-dom";
import { useLoaderData, useAsyncValue, Await } from "react-router";
import { Account } from "../ApiClient";
import ListGroup from "react-bootstrap/ListGroup";
import { LinkContainer } from "react-router-bootstrap";
2 changes: 1 addition & 1 deletion app/src/accounts/AccountSummary.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import Breadcrumb from "react-bootstrap/Breadcrumb";
import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
import ListGroup from "react-bootstrap/ListGroup";
import { useFetcher, useParams, useRouteLoaderData } from "react-router-dom";
import { useFetcher, useParams, useRouteLoaderData } from "react-router";
import {
ChangeEvent,
FormEvent,
2 changes: 1 addition & 1 deletion app/src/accounts/NextSteps/AggregatorTypeSelection.tsx
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import {
useParams,
useLoaderData,
useRevalidator,
} from "react-router-dom";
} from "react-router";
import ApiClient, {
Aggregator,
NewAggregator,
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, Col, Row } from "react-bootstrap";
import { useFetcher, useParams, useRevalidator } from "react-router-dom";
import { useFetcher, useParams, useRevalidator } from "react-router";
import { ApiToken } from "../../ApiClient";
import React from "react";
import useInterval from "use-interval";
2 changes: 1 addition & 1 deletion app/src/accounts/NextSteps/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Steps } from "primereact/steps";
import { Button, Card, Col, Row } from "react-bootstrap";
import { useLoaderData } from "react-router-dom";
import { useLoaderData } from "react-router";
import {
Account,
Aggregator,
2 changes: 1 addition & 1 deletion app/src/accounts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject, redirect } from "react-router-dom";
import { RouteObject, redirect } from "react-router";
import ApiClient, { NewAccount, UpdateAccount } from "../ApiClient";
import AccountSummary from "./AccountSummary";
import AccountForm from "./AccountForm";
2 changes: 1 addition & 1 deletion app/src/admin/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient from "../ApiClient";

export default function admin(
2 changes: 1 addition & 1 deletion app/src/aggregators/AggregatorDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useLoaderData, useParams } from "react-router-dom";
import { Await, useLoaderData, useParams } from "react-router";
import { Aggregator } from "../ApiClient";
import { AccountBreadcrumbs } from "../util";
import { LinkContainer } from "react-router-bootstrap";
2 changes: 1 addition & 1 deletion app/src/aggregators/AggregatorForm.tsx
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import {
useNavigate,
useNavigation,
useParams,
} from "react-router-dom";
} from "react-router";
import { ApiClientContext } from "../ApiClientContext";

async function submit(
2 changes: 1 addition & 1 deletion app/src/aggregators/AggregatorList.tsx
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import { AccountBreadcrumbs, WithAccount } from "../util";
import { CloudUpload } from "react-bootstrap-icons";
import { Suspense } from "react";
import { LinkContainer } from "react-router-bootstrap";
import { Await, useLoaderData } from "react-router-dom";
import { Await, useLoaderData } from "react-router";
import { Aggregator } from "../ApiClient";
import { ListGroup } from "react-bootstrap";
import D from "../logo/color/svg/small.svg";
2 changes: 1 addition & 1 deletion app/src/aggregators/DeleteAggregatorButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher, useNavigation } from "react-router-dom";
import { useFetcher, useNavigation } from "react-router";
import React, { useEffect, useState } from "react";
import { Trash } from "react-bootstrap-icons";
import { Button, Modal } from "react-bootstrap";
2 changes: 1 addition & 1 deletion app/src/aggregators/RenameAggregatorButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher } from "react-router-dom";
import { useFetcher } from "react-router";
import React from "react";
import { Pencil, PencilSquare } from "react-bootstrap-icons";
import {
2 changes: 1 addition & 1 deletion app/src/aggregators/RotateBearerTokenButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher } from "react-router-dom";
import { useFetcher } from "react-router";
import React from "react";
import { ArrowRepeat } from "react-bootstrap-icons";
import {
2 changes: 1 addition & 1 deletion app/src/aggregators/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import Aggregators from "./AggregatorList";
import AggregatorFormPage from "./AggregatorForm";
import AggregatorDetail from "./AggregatorDetail";
import ApiClient from "../ApiClient";
import { RouteObject, redirect } from "react-router-dom";
import { RouteObject, redirect } from "react-router";

export default function aggregators(apiClient: ApiClient): RouteObject {
return {
2 changes: 1 addition & 1 deletion app/src/api-tokens/ApiTokenList.tsx
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import {
useFetcher,
useLoaderData,
useNavigation,
} from "react-router-dom";
} from "react-router";
import { ApiToken } from "../ApiClient";
import Table from "react-bootstrap/Table";
import React from "react";
2 changes: 1 addition & 1 deletion app/src/api-tokens/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient from "../ApiClient";
import ApiTokens from "./ApiTokenList";

Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import {
Row,
} from "react-bootstrap";
import { KeyFill } from "react-bootstrap-icons";
import { useFetcher } from "react-router-dom";
import { useFetcher } from "react-router";
import { formikErrors } from "../ApiClient";
import { CopyCode } from "../util";

7 changes: 1 addition & 6 deletions app/src/collector-credentials/CollectorCredentialList.tsx
Original file line number Diff line number Diff line change
@@ -12,12 +12,7 @@ import {
XCircle,
} from "react-bootstrap-icons";
import { Suspense, useCallback, useEffect, useState } from "react";
import {
Await,
useFetcher,
useLoaderData,
useNavigation,
} from "react-router-dom";
import { Await, useFetcher, useLoaderData, useNavigation } from "react-router";
import { CollectorCredential } from "../ApiClient";
import Table from "react-bootstrap/Table";
import React from "react";
2 changes: 1 addition & 1 deletion app/src/collector-credentials/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient from "../ApiClient";
import CollectorCredentials from "./CollectorCredentialList";
export default function collectorCredentials(
2 changes: 1 addition & 1 deletion app/src/layout/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AxiosError } from "axios";
import Alert from "react-bootstrap/Alert";
import { isRouteErrorResponse, useRouteError } from "react-router-dom";
import { isRouteErrorResponse, useRouteError } from "react-router";
import ApiClient from "../ApiClient";
import Layout from "./Layout";
import React from "react";
2 changes: 1 addition & 1 deletion app/src/layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, Link, useAsyncValue, useLoaderData } from "react-router-dom";
import { Await, Link, useAsyncValue, useLoaderData } from "react-router";
import Container from "react-bootstrap/Container";
import Navbar from "react-bootstrap/Navbar";
import { User } from "../ApiClient";
2 changes: 1 addition & 1 deletion app/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";
import Container from "react-bootstrap/Container";
import Header, { HeaderPlaceholder } from "./Header";

2 changes: 1 addition & 1 deletion app/src/layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient from "../ApiClient";
import ErrorPage from "./ErrorPage";
import Layout from "./Layout";
2 changes: 1 addition & 1 deletion app/src/memberships/Memberships.tsx
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ import {
useRouteLoaderData,
Form,
useSubmit,
} from "react-router-dom";
} from "react-router";
import React, { Suspense, useState } from "react";
import { Membership, User } from "../ApiClient";
import { Button, FormControl } from "react-bootstrap";
2 changes: 1 addition & 1 deletion app/src/memberships/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient from "../ApiClient";
import Memberships from "./Memberships";

2 changes: 1 addition & 1 deletion app/src/queue/Queue.tsx
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import { Outlet, useLoaderData, useRevalidator } from "react-router";
import { QueueJob } from "../ApiClient";
import useInterval from "use-interval";
import { LinkContainer } from "react-router-bootstrap";
import { useSearchParams } from "react-router-dom";
import { useSearchParams } from "react-router";
import "@github/relative-time-element";
import { DateTime } from "luxon";

2 changes: 1 addition & 1 deletion app/src/queue/QueueJob.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { CheckSquare, Stopwatch, XCircle } from "react-bootstrap-icons";
import { useLoaderData } from "react-router";
import { QueueJob } from "../ApiClient";
import { DateTime } from "luxon";
import { Link } from "react-router-dom";
import { Link } from "react-router";

export const Component = QueueJobComponent;

2 changes: 1 addition & 1 deletion app/src/router.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import {
RouterProvider,
RouteObject,
redirect,
} from "react-router-dom";
} from "react-router";
import { ApiClientContext } from "./ApiClientContext";
import { ApiClient } from "./ApiClient";
import layout from "./layout";
2 changes: 1 addition & 1 deletion app/src/shared-aggregators/SharedAggregatorForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FormikHelpers } from "formik";
import ApiClient, { NewAggregator, formikErrors } from "../ApiClient";
import { AggregatorForm } from "../aggregators/AggregatorForm";
import { useRevalidator } from "react-router-dom";
import { useRevalidator } from "react-router";
import { ApiClientContext } from "../ApiClientContext";
import React from "react";

7 changes: 1 addition & 6 deletions app/src/shared-aggregators/SharedAggregatorList.tsx
Original file line number Diff line number Diff line change
@@ -11,12 +11,7 @@ import {
Placeholder,
Row,
} from "react-bootstrap";
import {
Await,
useFetcher,
useLoaderData,
useNavigation,
} from "react-router-dom";
import { Await, useFetcher, useLoaderData, useNavigation } from "react-router";
import { Aggregator } from "../ApiClient";
import "@github/relative-time-element";
import { Suspense, useEffect, useState } from "react";
2 changes: 1 addition & 1 deletion app/src/shared-aggregators/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";
import ApiClient, { UpdateAggregator } from "../ApiClient";

export default function sharedAggregators(apiClient: ApiClient): RouteObject {
2 changes: 1 addition & 1 deletion app/src/swagger-ui.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RouteObject } from "react-router-dom";
import { RouteObject } from "react-router";

export default function swaggerUi(): RouteObject {
return {
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/ClientConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLoaderData } from "react-router-dom";
import { useLoaderData } from "react-router";
import Col from "react-bootstrap/Col";
import { Tab, Tabs } from "react-bootstrap";
import { Task, Aggregator } from "../../ApiClient";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/CollectorAuthTokens.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher } from "react-router-dom";
import { useFetcher } from "react-router";
import Col from "react-bootstrap/Col";
import React from "react";
import { Aggregator, CollectorAuthToken } from "../../ApiClient";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/DeleteTaskButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher, useNavigation } from "react-router-dom";
import { useFetcher, useNavigation } from "react-router";
import React, { useEffect, useState } from "react";
import { Trash } from "react-bootstrap-icons";
import { Button, Modal } from "react-bootstrap";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/DisableTaskButton.tsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import {
useLoaderData,
useNavigation,
useParams,
} from "react-router-dom";
} from "react-router";
import React, { FormEvent, useCallback, useEffect, useState } from "react";
import { Play, SignStop } from "react-bootstrap-icons";
import { Button, Modal } from "react-bootstrap";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/Metrics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useLoaderData } from "react-router-dom";
import { Await, useLoaderData } from "react-router";
import Col from "react-bootstrap/Col";
import { Suspense } from "react";
import { Aggregator, Task } from "../../ApiClient";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/RenameTaskButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useFetcher } from "react-router-dom";
import { useFetcher } from "react-router";
import { useCallback, useEffect, useState } from "react";
import { Pencil, PencilSquare } from "react-bootstrap-icons";
import {
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/TaskPropertyTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useParams, useLoaderData, Link } from "react-router-dom";
import { Await, useParams, useLoaderData, Link } from "react-router";
import Col from "react-bootstrap/Col";
import { Suspense } from "react";
import { Task, Aggregator, CollectorCredential } from "../../ApiClient";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskDetail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useParams, useLoaderData } from "react-router-dom";
import { Await, useParams, useLoaderData } from "react-router";
import Breadcrumb from "react-bootstrap/Breadcrumb";
import React, { Suspense } from "react";
import Row from "react-bootstrap/Row";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskForm/HelperAggregator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useLoaderData } from "react-router-dom";
import { Await, useLoaderData } from "react-router";
import FormControl from "react-bootstrap/FormControl";
import FormSelect from "react-bootstrap/FormSelect";
import { Suspense } from "react";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskForm/LeaderAggregator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Await, useLoaderData } from "react-router-dom";
import { Await, useLoaderData } from "react-router";
import FormControl from "react-bootstrap/FormControl";
import FormSelect from "react-bootstrap/FormSelect";
import { Suspense } from "react";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskForm/QueryType.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLoaderData } from "react-router-dom";
import { useLoaderData } from "react-router";
import React, { ChangeEvent } from "react";
import { Aggregator } from "../../ApiClient";
import FormCheck from "react-bootstrap/FormCheck";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskForm/VdafType.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLoaderData } from "react-router-dom";
import { useLoaderData } from "react-router";
import FormControl from "react-bootstrap/FormControl";
import FormSelect from "react-bootstrap/FormSelect";
import { Aggregator } from "../../ApiClient";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskForm/index.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import {
useNavigation,
useParams,
NavigateFunction,
} from "react-router-dom";
} from "react-router";
import Breadcrumb from "react-bootstrap/Breadcrumb";
import Button from "react-bootstrap/Button";
import Col from "react-bootstrap/Col";
2 changes: 1 addition & 1 deletion app/src/tasks/TaskList.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import Breadcrumb from "react-bootstrap/Breadcrumb";
import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
import ListGroup from "react-bootstrap/ListGroup";
import { Await, useLoaderData, useAsyncValue } from "react-router-dom";
import { Await, useLoaderData, useAsyncValue } from "react-router";
import { Suspense } from "react";
import { Task } from "../ApiClient";
import { Alert, Button, Spinner } from "react-bootstrap";
2 changes: 1 addition & 1 deletion app/src/tasks/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import AccountDetailFull from "./TaskList";
import TaskForm from "./TaskForm";
import TaskDetail from "./TaskDetail";
import ApiClient from "../ApiClient";
import { RouteObject, redirect } from "react-router-dom";
import { RouteObject, redirect } from "react-router";

export default function tasks(apiClient: ApiClient): RouteObject {
return {
2 changes: 1 addition & 1 deletion app/src/util.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import Col from "react-bootstrap/Col";
import Row from "react-bootstrap/Row";
import { LinkContainer } from "react-router-bootstrap";
import React, { Suspense, useRef } from "react";
import { Await, useRouteLoaderData, useLoaderData } from "react-router-dom";
import { Await, useRouteLoaderData, useLoaderData } from "react-router";
import { Account } from "./ApiClient";
import Placeholder from "react-bootstrap/Placeholder";
import { Button, OverlayTrigger, Tooltip } from "react-bootstrap";