Skip to content

Commit 889be28

Browse files
feat: initial codemod remix > rr7
1 parent 4102828 commit 889be28

File tree

74 files changed

+9156
-14380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+9156
-14380
lines changed

app/components/error-boundary.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
type ErrorResponse,
3-
isRouteErrorResponse,
4-
useParams,
5-
useRouteError,
6-
} from '@remix-run/react'
1+
import { type ErrorResponse, isRouteErrorResponse, useParams, useRouteError } from 'react-router';
72
import { captureRemixErrorBoundaryError } from '@sentry/remix'
83
import { type ReactElement } from 'react'
94
import { getErrorMessage } from '#app/utils/misc.tsx'

app/components/progress-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useNavigation } from '@remix-run/react'
1+
import { useNavigation } from 'react-router';
22
import { useEffect, useRef, useState } from 'react'
33
import { useSpinDelay } from 'spin-delay'
44
import { cn } from '#app/utils/misc.tsx'

app/components/search-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Form, useSearchParams, useSubmit } from '@remix-run/react'
1+
import { Form, useSearchParams, useSubmit } from 'react-router';
22
import { useId } from 'react'
33
import { useDebounce, useIsPending } from '#app/utils/misc.tsx'
44
import { Icon } from './ui/icon.tsx'

app/entry.client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RemixBrowser } from '@remix-run/react'
1+
import { HydratedRouter } from 'react-router/dom';
22
import { startTransition } from 'react'
33
import { hydrateRoot } from 'react-dom/client'
44

@@ -7,5 +7,5 @@ if (ENV.MODE === 'production' && ENV.SENTRY_DSN) {
77
}
88

99
startTransition(() => {
10-
hydrateRoot(document, <RemixBrowser />)
10+
hydrateRoot(document, <HydratedRouter />)
1111
})

app/entry.server.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { PassThrough } from 'node:stream'
2+
import { createReadableStreamFromReadable } from '@react-router/node';
3+
24
import {
3-
createReadableStreamFromReadable,
4-
type LoaderFunctionArgs,
5-
type ActionFunctionArgs,
6-
type HandleDocumentRequestFunction,
7-
} from '@remix-run/node'
8-
import { RemixServer } from '@remix-run/react'
5+
type LoaderFunctionArgs,
6+
type ActionFunctionArgs,
7+
type HandleDocumentRequestFunction,
8+
} from 'react-router';
9+
10+
import { ServerRouter } from 'react-router';
911
import * as Sentry from '@sentry/remix'
1012
import chalk from 'chalk'
1113
import { isbot } from 'isbot'
@@ -27,7 +29,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
2729
request,
2830
responseStatusCode,
2931
responseHeaders,
30-
remixContext,
32+
reactRouterContext,
3133
loadContext,
3234
] = args
3335
const { currentInstance, primaryInstance } = await getInstanceInfo()
@@ -53,7 +55,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
5355

5456
const { pipe, abort } = renderToPipeableStream(
5557
<NonceProvider value={nonce}>
56-
<RemixServer nonce={nonce} context={remixContext} url={request.url} />
58+
<ServerRouter nonce={nonce} context={reactRouterContext} url={request.url} />
5759
</NonceProvider>,
5860
{
5961
[callbackName]: () => {
@@ -79,7 +81,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
7981
)
8082

8183
setTimeout(abort, streamTimeout + 5000)
82-
})
84+
});
8385
}
8486

8587
export async function handleDataRequest(response: Response) {

app/root.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import {
2-
data,
3-
type LoaderFunctionArgs,
4-
type HeadersFunction,
5-
type LinksFunction,
6-
type MetaFunction,
7-
} from '@remix-run/node'
2+
data,
3+
type LoaderFunctionArgs,
4+
type HeadersFunction,
5+
type LinksFunction,
6+
type MetaFunction,
7+
} from 'react-router';
88
import {
9-
Form,
10-
Link,
11-
Links,
12-
Meta,
13-
Outlet,
14-
Scripts,
15-
ScrollRestoration,
16-
useLoaderData,
17-
useMatches,
18-
useSubmit,
19-
} from '@remix-run/react'
9+
Form,
10+
Link,
11+
Links,
12+
Meta,
13+
Outlet,
14+
Scripts,
15+
ScrollRestoration,
16+
useLoaderData,
17+
useMatches,
18+
useSubmit,
19+
} from 'react-router';
2020
import { withSentry } from '@sentry/remix'
2121
import { useRef } from 'react'
2222
import { HoneypotProvider } from 'remix-utils/honeypot/react'

app/routes/$.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// ensure the user gets the right status code and we can display a nicer error
66
// message for them than the Remix and/or browser default.
77

8-
import { Link, useLocation } from '@remix-run/react'
8+
import { Link, useLocation } from 'react-router';
99
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
1010
import { Icon } from '#app/components/ui/icon.tsx'
1111

app/routes/_auth+/auth.$provider.callback.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { redirect, type LoaderFunctionArgs } from '@remix-run/node'
1+
import { redirect, type LoaderFunctionArgs } from 'react-router';
22
import {
33
authenticator,
44
getSessionExpirationDate,
@@ -39,8 +39,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
3939
const authResult = await authenticator
4040
.authenticate(providerName, request, { throwOnError: true })
4141
.then(
42-
(data) => ({ success: true, data }) as const,
43-
(error) => ({ success: false, error }) as const,
42+
(data) => (({
43+
success: true,
44+
data
45+
}) as const),
46+
(error) => (({
47+
success: false,
48+
error
49+
}) as const),
4450
)
4551

4652
if (!authResult.success) {

app/routes/_auth+/auth_.$provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { redirect, type ActionFunctionArgs } from '@remix-run/node'
1+
import { redirect, type ActionFunctionArgs } from 'react-router';
22
import { authenticator } from '#app/utils/auth.server.ts'
33
import { handleMockAction } from '#app/utils/connections.server.ts'
44
import { ProviderNameSchema } from '#app/utils/connections.tsx'

app/routes/_auth+/forgot-password.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ import { getFormProps, getInputProps, useForm } from '@conform-to/react'
22
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
33
import { type SEOHandle } from '@nasa-gcn/remix-seo'
44
import * as E from '@react-email/components'
5-
import {
6-
data,
7-
redirect,
8-
type ActionFunctionArgs,
9-
type MetaFunction,
10-
} from '@remix-run/node'
11-
import { Link, useFetcher } from '@remix-run/react'
5+
import { data, redirect, type ActionFunctionArgs, type MetaFunction } from 'react-router';
6+
import { Link, useFetcher } from 'react-router';
127
import { HoneypotInputs } from 'remix-utils/honeypot/react'
138
import { z } from 'zod'
149
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'

0 commit comments

Comments
 (0)