Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e899918
activate v3_singleFetch
hakimLyon Oct 13, 2024
d0a9ff5
mv installGlobals --> vite conf
hakimLyon Oct 14, 2024
56603cc
Fix: playwright failures
hakimLyon Oct 16, 2024
e6eca57
add installGlobals
hakimLyon Oct 16, 2024
c2d2244
Fix: eslint
hakimLyon Oct 16, 2024
b4d40b6
format
hakimLyon Oct 16, 2024
cb2f5c9
import as data
hakimLyon Oct 16, 2024
6b40b78
remove installGlobals
hakimLyon Oct 16, 2024
5044ab5
fix typecheck
hakimLyon Oct 16, 2024
359f494
rename auth.$provider to auth_.$provider
hakimLyon Oct 20, 2024
edb182e
Merge branch 'main' into v3_singleFetch
hakimLyon Oct 21, 2024
bc898bc
enable v3_singleFetch
hakimLyon Oct 21, 2024
75a6fc3
Merge branch 'hakim-single-fetch' into feat/migrate-to-react-router-7
DennisKraaijeveld Dec 31, 2024
4102828
feat: init
DennisKraaijeveld Dec 31, 2024
889be28
feat: initial codemod remix > rr7
DennisKraaijeveld Dec 31, 2024
96a2142
feat: SerializeFrom: https://github.com/remix-run/react-router/discus…
DennisKraaijeveld Dec 31, 2024
44a44b9
feat: await results from submit hooks
DennisKraaijeveld Dec 31, 2024
a9a9553
feat: move to new file uploading package
DennisKraaijeveld Dec 31, 2024
55645fc
feat: add routes.ts
DennisKraaijeveld Dec 31, 2024
f016946
feat: typegen
DennisKraaijeveld Dec 31, 2024
eeb5069
feat: rr config file; enable ssr
DennisKraaijeveld Dec 31, 2024
66815e6
feat: rr config file; enable ssr
DennisKraaijeveld Dec 31, 2024
939c7b6
fix: move ignore .react-router to the correct file
DennisKraaijeveld Dec 31, 2024
ac9ad5e
fix: remove typegen folder
DennisKraaijeveld Dec 31, 2024
1c2f055
feat: small fixes
DennisKraaijeveld Dec 31, 2024
489f675
feat: code format/styling
DennisKraaijeveld Dec 31, 2024
a31cce4
fix: dev server broke due to sentry package
DennisKraaijeveld Dec 31, 2024
de4c39a
fix: uncommented commented comment jeezz
DennisKraaijeveld Dec 31, 2024
31d4690
feat: prod server
DennisKraaijeveld Dec 31, 2024
e5b70ac
feat: move to @sentry/node
DennisKraaijeveld Jan 4, 2025
1895661
fix: typo
DennisKraaijeveld Jan 4, 2025
1c7480d
fix: correct import sentry node
DennisKraaijeveld Jan 4, 2025
2084016
chore: format everything
kentcdodds Jan 15, 2025
0f380b5
use new type helpers
kentcdodds Jan 15, 2025
e06e003
remove use of SerializeFrom
kentcdodds Jan 16, 2025
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
7 changes: 1 addition & 6 deletions app/components/error-boundary.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
type ErrorResponse,
isRouteErrorResponse,
useParams,
useRouteError,
} from '@remix-run/react'
import { type ErrorResponse, isRouteErrorResponse, useParams, useRouteError } from 'react-router';
import { captureRemixErrorBoundaryError } from '@sentry/remix'
import { type ReactElement } from 'react'
import { getErrorMessage } from '#app/utils/misc.tsx'
Expand Down
2 changes: 1 addition & 1 deletion app/components/progress-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigation } from '@remix-run/react'
import { useNavigation } from 'react-router';
import { useEffect, useRef, useState } from 'react'
import { useSpinDelay } from 'spin-delay'
import { cn } from '#app/utils/misc.tsx'
Expand Down
2 changes: 1 addition & 1 deletion app/components/search-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Form, useSearchParams, useSubmit } from '@remix-run/react'
import { Form, useSearchParams, useSubmit } from 'react-router';
import { useId } from 'react'
import { useDebounce, useIsPending } from '#app/utils/misc.tsx'
import { Icon } from './ui/icon.tsx'
Expand Down
4 changes: 2 additions & 2 deletions app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RemixBrowser } from '@remix-run/react'
import { HydratedRouter } from 'react-router/dom';
import { startTransition } from 'react'
import { hydrateRoot } from 'react-dom/client'

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

startTransition(() => {
hydrateRoot(document, <RemixBrowser />)
hydrateRoot(document, <HydratedRouter />)
})
24 changes: 13 additions & 11 deletions app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { PassThrough } from 'node:stream'
import { createReadableStreamFromReadable } from '@react-router/node';

import {
createReadableStreamFromReadable,
type LoaderFunctionArgs,
type ActionFunctionArgs,
type HandleDocumentRequestFunction,
} from '@remix-run/node'
import { RemixServer } from '@remix-run/react'
type LoaderFunctionArgs,
type ActionFunctionArgs,
type HandleDocumentRequestFunction,
} from 'react-router';

import { ServerRouter } from 'react-router';
import * as Sentry from '@sentry/remix'
import chalk from 'chalk'
import { isbot } from 'isbot'
Expand All @@ -15,7 +17,7 @@ import { getInstanceInfo } from './utils/litefs.server.ts'
import { NonceProvider } from './utils/nonce-provider.ts'
import { makeTimings } from './utils/timing.server.ts'

const ABORT_DELAY = 5000
export const streamTimeout = 5000

init()
global.ENV = getEnv()
Expand All @@ -27,7 +29,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
request,
responseStatusCode,
responseHeaders,
remixContext,
reactRouterContext,
loadContext,
] = args
const { currentInstance, primaryInstance } = await getInstanceInfo()
Expand All @@ -53,7 +55,7 @@ export default async function handleRequest(...args: DocRequestArgs) {

const { pipe, abort } = renderToPipeableStream(
<NonceProvider value={nonce}>
<RemixServer context={remixContext} url={request.url} />
<ServerRouter nonce={nonce} context={reactRouterContext} url={request.url} />
</NonceProvider>,
{
[callbackName]: () => {
Expand All @@ -78,8 +80,8 @@ export default async function handleRequest(...args: DocRequestArgs) {
},
)

setTimeout(abort, ABORT_DELAY)
})
setTimeout(abort, streamTimeout + 5000)
});
}

export async function handleDataRequest(response: Response) {
Expand Down
15 changes: 7 additions & 8 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { withSentry } from '@sentry/remix'
import { useRef } from 'react'
import {
json,
data,
type LoaderFunctionArgs,
type HeadersFunction,
type LinksFunction,
type MetaFunction,
} from '@remix-run/node'
import {
Form,
Link,
Links,
Expand All @@ -16,9 +16,7 @@ import {
useLoaderData,
useMatches,
useSubmit,
} from '@remix-run/react'
import { withSentry } from '@sentry/remix'
import { useRef } from 'react'
} from 'react-router'
import { HoneypotProvider } from 'remix-utils/honeypot/react'
import appleTouchIconAssetUrl from './assets/favicons/apple-touch-icon.png'
import faviconAssetUrl from './assets/favicons/favicon.svg'
Expand Down Expand Up @@ -121,7 +119,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
const { toast, headers: toastHeaders } = await getToast(request)
const honeyProps = honeypot.getInputProps()

return json(
return data(
{
user,
requestInfo: {
Expand Down Expand Up @@ -161,7 +159,8 @@ function Document({
children: React.ReactNode
nonce: string
theme?: Theme
env?: Record<string, string>
env?: Record<string, string | undefined>
allowIndexing?: boolean
}) {
const allowIndexing = ENV.ALLOW_INDEXING !== 'false'
return (
Expand Down
2 changes: 1 addition & 1 deletion app/routes/$.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// ensure the user gets the right status code and we can display a nicer error
// message for them than the Remix and/or browser default.

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

Expand Down
12 changes: 9 additions & 3 deletions app/routes/_auth+/auth.$provider.callback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { redirect, type LoaderFunctionArgs } from '@remix-run/node'
import { redirect, type LoaderFunctionArgs } from 'react-router';
import {
authenticator,
getSessionExpirationDate,
Expand Down Expand Up @@ -39,8 +39,14 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const authResult = await authenticator
.authenticate(providerName, request, { throwOnError: true })
.then(
(data) => ({ success: true, data }) as const,
(error) => ({ success: false, error }) as const,
(data) => (({
success: true,
data
}) as const),
(error) => (({
success: false,
error
}) as const),
)

if (!authResult.success) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { redirect, type ActionFunctionArgs } from '@remix-run/node'
import { redirect, type ActionFunctionArgs } from 'react-router';
import { authenticator } from '#app/utils/auth.server.ts'
import { handleMockAction } from '#app/utils/connections.server.ts'
import { ProviderNameSchema } from '#app/utils/connections.tsx'
Expand Down
13 changes: 4 additions & 9 deletions app/routes/_auth+/forgot-password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ import { getFormProps, getInputProps, useForm } from '@conform-to/react'
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import { type SEOHandle } from '@nasa-gcn/remix-seo'
import * as E from '@react-email/components'
import {
json,
redirect,
type ActionFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import { Link, useFetcher } from '@remix-run/react'
import { data, redirect, type ActionFunctionArgs, type MetaFunction } from 'react-router';
import { Link, useFetcher } from 'react-router';
import { HoneypotInputs } from 'remix-utils/honeypot/react'
import { z } from 'zod'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
Expand Down Expand Up @@ -54,7 +49,7 @@ export async function action({ request }: ActionFunctionArgs) {
async: true,
})
if (submission.status !== 'success') {
return json(
return data(
{ result: submission.reply() },
{ status: submission.status === 'error' ? 400 : 200 },
)
Expand Down Expand Up @@ -84,7 +79,7 @@ export async function action({ request }: ActionFunctionArgs) {
if (response.status === 'success') {
return redirect(redirectTo.toString())
} else {
return json(
return data(
{ result: submission.reply({ formErrors: [response.error.message] }) },
{ status: 500 },
)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/login.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invariant } from '@epic-web/invariant'
import { redirect } from '@remix-run/node'
import { redirect } from 'react-router';
import { safeRedirect } from 'remix-utils/safe-redirect'
import { twoFAVerificationType } from '#app/routes/settings+/profile.two-factor.tsx'
import { getUserId, sessionKey } from '#app/utils/auth.server.ts'
Expand Down
13 changes: 4 additions & 9 deletions app/routes/_auth+/login.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { getFormProps, getInputProps, useForm } from '@conform-to/react'
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import { type SEOHandle } from '@nasa-gcn/remix-seo'
import {
json,
type ActionFunctionArgs,
type LoaderFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import { Form, Link, useActionData, useSearchParams } from '@remix-run/react'
import { data, type ActionFunctionArgs, type LoaderFunctionArgs, type MetaFunction } from 'react-router';
import { Form, Link, useActionData, useSearchParams } from 'react-router';
import { HoneypotInputs } from 'remix-utils/honeypot/react'
import { z } from 'zod'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
Expand Down Expand Up @@ -37,7 +32,7 @@ const LoginFormSchema = z.object({

export async function loader({ request }: LoaderFunctionArgs) {
await requireAnonymous(request)
return json({})
return {}
}

export async function action({ request }: ActionFunctionArgs) {
Expand All @@ -64,7 +59,7 @@ export async function action({ request }: ActionFunctionArgs) {
})

if (submission.status !== 'success' || !submission.value.session) {
return json(
return data(
{ result: submission.reply({ hideFields: ['password'] }) },
{ status: submission.status === 'error' ? 400 : 200 },
)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { redirect, type ActionFunctionArgs } from '@remix-run/node'
import { redirect, type ActionFunctionArgs } from 'react-router';
import { logout } from '#app/utils/auth.server.ts'

export async function loader() {
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/onboarding.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invariant } from '@epic-web/invariant'
import { redirect } from '@remix-run/node'
import { redirect } from 'react-router';
import { verifySessionStorage } from '#app/utils/verification.server.ts'
import { onboardingEmailSessionKey } from './onboarding.tsx'
import { type VerifyFunctionArgs } from './verify.server.ts'
Expand Down
23 changes: 9 additions & 14 deletions app/routes/_auth+/onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { getFormProps, getInputProps, useForm } from '@conform-to/react'
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import {
json,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import {
Form,
useActionData,
useLoaderData,
useSearchParams,
} from '@remix-run/react'
data,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
type MetaFunction,
} from 'react-router';
import { Form, useActionData, useLoaderData, useSearchParams } from 'react-router';
import { HoneypotInputs } from 'remix-utils/honeypot/react'
import { safeRedirect } from 'remix-utils/safe-redirect'
import { z } from 'zod'
Expand Down Expand Up @@ -61,7 +56,7 @@ async function requireOnboardingEmail(request: Request) {

export async function loader({ request }: LoaderFunctionArgs) {
const email = await requireOnboardingEmail(request)
return json({ email })
return { email }
}

export async function action({ request }: ActionFunctionArgs) {
Expand Down Expand Up @@ -93,7 +88,7 @@ export async function action({ request }: ActionFunctionArgs) {
})

if (submission.status !== 'success' || !submission.value.session) {
return json(
return data(
{ result: submission.reply() },
{ status: submission.status === 'error' ? 400 : 200 },
)
Expand Down
2 changes: 1 addition & 1 deletion app/routes/_auth+/onboarding_.$provider.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invariant } from '@epic-web/invariant'
import { redirect } from '@remix-run/node'
import { redirect } from 'react-router';
import { verifySessionStorage } from '#app/utils/verification.server.ts'
import { onboardingEmailSessionKey } from './onboarding.tsx'
import { type VerifyFunctionArgs } from './verify.server.ts'
Expand Down
26 changes: 10 additions & 16 deletions app/routes/_auth+/onboarding_.$provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ import {
} from '@conform-to/react'
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
import {
redirect,
json,
type ActionFunctionArgs,
type LoaderFunctionArgs,
type MetaFunction,
} from '@remix-run/node'
import {
type Params,
Form,
useActionData,
useLoaderData,
useSearchParams,
} from '@remix-run/react'
redirect,
data,
type ActionFunctionArgs,
type LoaderFunctionArgs,
type MetaFunction,
} from 'react-router';
import { type Params, Form, useActionData, useLoaderData, useSearchParams } from 'react-router';
import { safeRedirect } from 'remix-utils/safe-redirect'
import { z } from 'zod'
import { CheckboxField, ErrorList, Field } from '#app/components/forms.tsx'
Expand Down Expand Up @@ -95,15 +89,15 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const formError = connectionSession.get(authenticator.sessionErrorKey)
const hasError = typeof formError === 'string'

return json({
return {
email,
status: 'idle',
submission: {
status: hasError ? 'error' : undefined,
initialValue: prefilledProfile ?? {},
error: { '': hasError ? [formError] : [] },
} as SubmissionResult,
})
}
}

export async function action({ request, params }: ActionFunctionArgs) {
Expand Down Expand Up @@ -143,7 +137,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
})

if (submission.status !== 'success') {
return json(
return data(
{ result: submission.reply() },
{ status: submission.status === 'error' ? 400 : 200 },
)
Expand Down
4 changes: 2 additions & 2 deletions app/routes/_auth+/reset-password.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invariant } from '@epic-web/invariant'
import { json, redirect } from '@remix-run/node'
import { data, redirect } from 'react-router';
import { prisma } from '#app/utils/db.server.ts'
import { verifySessionStorage } from '#app/utils/verification.server.ts'
import { resetPasswordUsernameSessionKey } from './reset-password.tsx'
Expand All @@ -18,7 +18,7 @@ export async function handleVerification({ submission }: VerifyFunctionArgs) {
// we don't want to say the user is not found if the email is not found
// because that would allow an attacker to check if an email is registered
if (!user) {
return json(
return data(
{ result: submission.reply({ fieldErrors: { code: ['Invalid code'] } }) },
{ status: 400 },
)
Expand Down
Loading