Skip to content

Commit e899918

Browse files
committed
activate v3_singleFetch
1 parent db4c82a commit e899918

38 files changed

+244
-261
lines changed

app/entry.server.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { getInstanceInfo } from './utils/litefs.server.ts'
1515
import { NonceProvider } from './utils/nonce-provider.ts'
1616
import { makeTimings } from './utils/timing.server.ts'
1717

18-
const ABORT_DELAY = 5000
18+
export const streamTimeout = 5000
1919

2020
init()
2121
global.ENV = getEnv()
@@ -53,7 +53,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
5353

5454
const { pipe, abort } = renderToPipeableStream(
5555
<NonceProvider value={nonce}>
56-
<RemixServer context={remixContext} url={request.url} />
56+
<RemixServer nonce={nonce} context={remixContext} url={request.url} />
5757
</NonceProvider>,
5858
{
5959
[callbackName]: () => {
@@ -78,7 +78,7 @@ export default async function handleRequest(...args: DocRequestArgs) {
7878
},
7979
)
8080

81-
setTimeout(abort, ABORT_DELAY)
81+
setTimeout(abort, streamTimeout + 5000)
8282
})
8383
}
8484

app/root.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
json,
2+
data as dataResponse,
33
type LoaderFunctionArgs,
44
type HeadersFunction,
55
type LinksFunction,
@@ -117,7 +117,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
117117
const { toast, headers: toastHeaders } = await getToast(request)
118118
const honeyProps = honeypot.getInputProps()
119119

120-
return json(
120+
return dataResponse(
121121
{
122122
user,
123123
requestInfo: {
@@ -158,7 +158,7 @@ function Document({
158158
children: React.ReactNode
159159
nonce: string
160160
theme?: Theme
161-
env?: Record<string, string>
161+
env?: Record<string, string | undefined>
162162
allowIndexing?: boolean
163163
}) {
164164
return (

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getZodConstraint, parseWithZod } from '@conform-to/zod'
33
import { type SEOHandle } from '@nasa-gcn/remix-seo'
44
import * as E from '@react-email/components'
55
import {
6-
json,
6+
data as dataResponse,
77
redirect,
88
type ActionFunctionArgs,
99
type MetaFunction,
@@ -54,7 +54,7 @@ export async function action({ request }: ActionFunctionArgs) {
5454
async: true,
5555
})
5656
if (submission.status !== 'success') {
57-
return json(
57+
return dataResponse(
5858
{ result: submission.reply() },
5959
{ status: submission.status === 'error' ? 400 : 200 },
6060
)
@@ -84,7 +84,7 @@ export async function action({ request }: ActionFunctionArgs) {
8484
if (response.status === 'success') {
8585
return redirect(redirectTo.toString())
8686
} else {
87-
return json(
87+
return dataResponse(
8888
{ result: submission.reply({ formErrors: [response.error.message] }) },
8989
{ status: 500 },
9090
)

app/routes/_auth+/login.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ 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 {
5-
json,
5+
data as dataResponse,
66
type ActionFunctionArgs,
77
type LoaderFunctionArgs,
88
type MetaFunction,
@@ -37,7 +37,7 @@ const LoginFormSchema = z.object({
3737

3838
export async function loader({ request }: LoaderFunctionArgs) {
3939
await requireAnonymous(request)
40-
return json({})
40+
return {}
4141
}
4242

4343
export async function action({ request }: ActionFunctionArgs) {
@@ -64,7 +64,7 @@ export async function action({ request }: ActionFunctionArgs) {
6464
})
6565

6666
if (submission.status !== 'success' || !submission.value.session) {
67-
return json(
67+
return dataResponse(
6868
{ result: submission.reply({ hideFields: ['password'] }) },
6969
{ status: submission.status === 'error' ? 400 : 200 },
7070
)

app/routes/_auth+/onboarding.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getFormProps, getInputProps, useForm } from '@conform-to/react'
22
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
33
import {
4-
json,
4+
data as dataResponse,
55
redirect,
66
type LoaderFunctionArgs,
77
type ActionFunctionArgs,
@@ -61,7 +61,7 @@ async function requireOnboardingEmail(request: Request) {
6161

6262
export async function loader({ request }: LoaderFunctionArgs) {
6363
const email = await requireOnboardingEmail(request)
64-
return json({ email })
64+
return { email }
6565
}
6666

6767
export async function action({ request }: ActionFunctionArgs) {
@@ -93,7 +93,7 @@ export async function action({ request }: ActionFunctionArgs) {
9393
})
9494

9595
if (submission.status !== 'success' || !submission.value.session) {
96-
return json(
96+
return dataResponse(
9797
{ result: submission.reply() },
9898
{ status: submission.status === 'error' ? 400 : 200 },
9999
)

app/routes/_auth+/onboarding_.$provider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { getZodConstraint, parseWithZod } from '@conform-to/zod'
88
import {
99
redirect,
10-
json,
10+
data as dataResponse,
1111
type ActionFunctionArgs,
1212
type LoaderFunctionArgs,
1313
type MetaFunction,
@@ -95,15 +95,15 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
9595
const formError = connectionSession.get(authenticator.sessionErrorKey)
9696
const hasError = typeof formError === 'string'
9797

98-
return json({
98+
return {
9999
email,
100100
status: 'idle',
101101
submission: {
102102
status: hasError ? 'error' : undefined,
103103
initialValue: prefilledProfile ?? {},
104104
error: { '': hasError ? [formError] : [] },
105105
} as SubmissionResult,
106-
})
106+
}
107107
}
108108

109109
export async function action({ request, params }: ActionFunctionArgs) {
@@ -143,7 +143,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
143143
})
144144

145145
if (submission.status !== 'success') {
146-
return json(
146+
return dataResponse(
147147
{ result: submission.reply() },
148148
{ status: submission.status === 'error' ? 400 : 200 },
149149
)

app/routes/_auth+/reset-password.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { invariant } from '@epic-web/invariant'
2-
import { json, redirect } from '@remix-run/node'
2+
import { data as dataResponse, redirect } from '@remix-run/node'
33
import { prisma } from '#app/utils/db.server.ts'
44
import { verifySessionStorage } from '#app/utils/verification.server.ts'
55
import { resetPasswordUsernameSessionKey } from './reset-password.tsx'
@@ -18,7 +18,7 @@ export async function handleVerification({ submission }: VerifyFunctionArgs) {
1818
// we don't want to say the user is not found if the email is not found
1919
// because that would allow an attacker to check if an email is registered
2020
if (!user) {
21-
return json(
21+
return dataResponse(
2222
{ result: submission.reply({ fieldErrors: { code: ['Invalid code'] } }) },
2323
{ status: 400 },
2424
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ 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 {
5-
json,
5+
data as dataResponse,
66
redirect,
77
type ActionFunctionArgs,
88
type LoaderFunctionArgs,
@@ -41,7 +41,7 @@ async function requireResetPasswordUsername(request: Request) {
4141

4242
export async function loader({ request }: LoaderFunctionArgs) {
4343
const resetPasswordUsername = await requireResetPasswordUsername(request)
44-
return json({ resetPasswordUsername })
44+
return { resetPasswordUsername }
4545
}
4646

4747
export async function action({ request }: ActionFunctionArgs) {
@@ -51,7 +51,7 @@ export async function action({ request }: ActionFunctionArgs) {
5151
schema: ResetPasswordSchema,
5252
})
5353
if (submission.status !== 'success') {
54-
return json(
54+
return dataResponse(
5555
{ result: submission.reply() },
5656
{ status: submission.status === 'error' ? 400 : 200 },
5757
)

app/routes/_auth+/signup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getZodConstraint, parseWithZod } from '@conform-to/zod'
33
import { type SEOHandle } from '@nasa-gcn/remix-seo'
44
import * as E from '@react-email/components'
55
import {
6-
json,
6+
data as dataResponse,
77
redirect,
88
type ActionFunctionArgs,
99
type MetaFunction,
@@ -56,7 +56,7 @@ export async function action({ request }: ActionFunctionArgs) {
5656
async: true,
5757
})
5858
if (submission.status !== 'success') {
59-
return json(
59+
return dataResponse(
6060
{ result: submission.reply() },
6161
{ status: submission.status === 'error' ? 400 : 200 },
6262
)
@@ -78,7 +78,7 @@ export async function action({ request }: ActionFunctionArgs) {
7878
if (response.status === 'success') {
7979
return redirect(redirectTo.toString())
8080
} else {
81-
return json(
81+
return dataResponse(
8282
{
8383
result: submission.reply({ formErrors: [response.error.message] }),
8484
},

app/routes/_auth+/verify.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type Submission } from '@conform-to/react'
22
import { parseWithZod } from '@conform-to/zod'
3-
import { json } from '@remix-run/node'
3+
import { data as dataResponse } from '@remix-run/node'
44
import { z } from 'zod'
55
import { handleVerification as handleChangeEmailVerification } from '#app/routes/settings+/profile.change-email.server.tsx'
66
import { twoFAVerificationType } from '#app/routes/settings+/profile.two-factor.tsx'
@@ -161,7 +161,7 @@ export async function validateRequest(
161161
})
162162

163163
if (submission.status !== 'success') {
164-
return json(
164+
return dataResponse(
165165
{ result: submission.reply() },
166166
{ status: submission.status === 'error' ? 400 : 200 },
167167
)

0 commit comments

Comments
 (0)