Skip to content

Commit 8cc76b5

Browse files
committed
replace DataFunctionArgs
1 parent 4c50be1 commit 8cc76b5

File tree

378 files changed

+1120
-840
lines changed

Some content is hidden

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

378 files changed

+1120
-840
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
This file will keep track of significant changes that have happened in the
4+
workshop material that is different from what you'll see in the videos.
5+
6+
## DataFunctionArgs
7+
8+
`DataFunctionArgs` was deprecated in Remix and will be removed in the future. It
9+
is recommended to use `LoaderFunctionArgs` and `ActionFunctionArgs` instead
10+
which are the exact same.

exercises/01.schema/01.problem.init/app/root.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import os from 'node:os'
22
import { cssBundleHref } from '@remix-run/css-bundle'
33
import {
44
json,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
type LinksFunction,
77
} from '@remix-run/node'
88
import {
@@ -38,7 +38,7 @@ export const links: LinksFunction = () => {
3838
].filter(Boolean)
3939
}
4040

41-
export async function loader({ request }: DataFunctionArgs) {
41+
export async function loader({ request }: LoaderFunctionArgs) {
4242
const [csrfToken, csrfCookieHeader] = await csrf.commitToken(request)
4343
const honeyProps = honeypot.getInputProps()
4444
return json(

exercises/01.schema/01.problem.init/app/routes/_auth+/signup.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
redirect,
3-
type DataFunctionArgs,
3+
type ActionFunctionArgs,
44
type MetaFunction,
55
} from '@remix-run/node'
66
import { Form } from '@remix-run/react'
@@ -12,7 +12,7 @@ import { Label } from '#app/components/ui/label.tsx'
1212
import { validateCSRF } from '#app/utils/csrf.server.ts'
1313
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
1414

15-
export async function action({ request }: DataFunctionArgs) {
15+
export async function action({ request }: ActionFunctionArgs) {
1616
const formData = await request.formData()
1717
await validateCSRF(formData, request.headers)
1818
checkHoneypot(formData)

exercises/01.schema/01.problem.init/app/routes/resources+/images.$imageId.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import fs from 'node:fs'
22
import { PassThrough } from 'node:stream'
33
import {
44
createReadableStreamFromReadable,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
} from '@remix-run/node'
77
import { db } from '#app/utils/db.server.ts'
88
import { invariantResponse } from '#app/utils/misc.tsx'
99

10-
export async function loader({ params }: DataFunctionArgs) {
10+
export async function loader({ params }: LoaderFunctionArgs) {
1111
invariantResponse(params.imageId, 'Invalid image ID')
1212
const image = db.image.findFirst({
1313
where: { id: { equals: params.imageId } },

exercises/01.schema/01.problem.init/app/routes/users+/$username.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { json, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { Spacer } from '#app/components/spacer.tsx'
55
import { Button } from '#app/components/ui/button.tsx'
66
import { db } from '#app/utils/db.server.ts'
77
import { getUserImgSrc, invariantResponse } from '#app/utils/misc.tsx'
88

9-
export async function loader({ params }: DataFunctionArgs) {
9+
export async function loader({ params }: LoaderFunctionArgs) {
1010
const user = db.user.findFirst({
1111
where: {
1212
username: {

exercises/01.schema/01.problem.init/app/routes/users+/$username_+/notes.$noteId.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
1+
import {
2+
json,
3+
redirect,
4+
type ActionFunctionArgs,
5+
type LoaderFunctionArgs,
6+
} from '@remix-run/node'
27
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
38
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
49
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
@@ -9,7 +14,7 @@ import { db } from '#app/utils/db.server.ts'
914
import { getNoteImgSrc, invariantResponse } from '#app/utils/misc.tsx'
1015
import { type loader as notesLoader } from './notes.tsx'
1116

12-
export async function loader({ params }: DataFunctionArgs) {
17+
export async function loader({ params }: LoaderFunctionArgs) {
1318
const note = db.note.findFirst({
1419
where: {
1520
id: {
@@ -29,7 +34,7 @@ export async function loader({ params }: DataFunctionArgs) {
2934
})
3035
}
3136

32-
export async function action({ request, params }: DataFunctionArgs) {
37+
export async function action({ request, params }: ActionFunctionArgs) {
3338
invariantResponse(params.noteId, 'noteId param is required')
3439

3540
const formData = await request.formData()

exercises/01.schema/01.problem.init/app/routes/users+/$username_+/notes.$noteId_.edit.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
json,
1313
unstable_parseMultipartFormData as parseMultipartFormData,
1414
redirect,
15-
type DataFunctionArgs,
15+
type ActionFunctionArgs,
16+
type LoaderFunctionArgs,
1617
} from '@remix-run/node'
1718
import { Form, useActionData, useLoaderData } from '@remix-run/react'
1819
import { useRef, useState } from 'react'
@@ -35,7 +36,7 @@ import {
3536
useIsPending,
3637
} from '#app/utils/misc.tsx'
3738

38-
export async function loader({ params }: DataFunctionArgs) {
39+
export async function loader({ params }: LoaderFunctionArgs) {
3940
const note = db.note.findFirst({
4041
where: {
4142
id: {
@@ -79,7 +80,7 @@ const NoteEditorSchema = z.object({
7980
images: z.array(ImageFieldsetSchema).max(5).optional(),
8081
})
8182

82-
export async function action({ request, params }: DataFunctionArgs) {
83+
export async function action({ request, params }: ActionFunctionArgs) {
8384
invariantResponse(params.noteId, 'noteId param is required')
8485

8586
const formData = await parseMultipartFormData(

exercises/01.schema/01.problem.init/app/routes/users+/$username_+/notes.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { json, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { db } from '#app/utils/db.server.ts'
55
import { cn, getUserImgSrc, invariantResponse } from '#app/utils/misc.tsx'
66

7-
export async function loader({ params }: DataFunctionArgs) {
7+
export async function loader({ params }: LoaderFunctionArgs) {
88
const owner = db.user.findFirst({
99
where: {
1010
username: {

exercises/01.schema/01.problem.init/app/routes/users+/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, redirect, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, useLoaderData } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { SearchBar } from '#app/components/search-bar.tsx'
55
import { db } from '#app/utils/db.server.ts'
66
import { cn, getUserImgSrc, useDelayedIsPending } from '#app/utils/misc.tsx'
77

8-
export async function loader({ request }: DataFunctionArgs) {
8+
export async function loader({ request }: LoaderFunctionArgs) {
99
const searchTerm = new URL(request.url).searchParams.get('search')
1010
if (searchTerm === '') {
1111
return redirect('/users')

exercises/01.schema/01.solution.init/app/root.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import os from 'node:os'
22
import { cssBundleHref } from '@remix-run/css-bundle'
33
import {
44
json,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
type LinksFunction,
77
} from '@remix-run/node'
88
import {
@@ -38,7 +38,7 @@ export const links: LinksFunction = () => {
3838
].filter(Boolean)
3939
}
4040

41-
export async function loader({ request }: DataFunctionArgs) {
41+
export async function loader({ request }: LoaderFunctionArgs) {
4242
const [csrfToken, csrfCookieHeader] = await csrf.commitToken(request)
4343
const honeyProps = honeypot.getInputProps()
4444
return json(

exercises/01.schema/01.solution.init/app/routes/_auth+/signup.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
redirect,
3-
type DataFunctionArgs,
3+
type ActionFunctionArgs,
44
type MetaFunction,
55
} from '@remix-run/node'
66
import { Form } from '@remix-run/react'
@@ -12,7 +12,7 @@ import { Label } from '#app/components/ui/label.tsx'
1212
import { validateCSRF } from '#app/utils/csrf.server.ts'
1313
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
1414

15-
export async function action({ request }: DataFunctionArgs) {
15+
export async function action({ request }: ActionFunctionArgs) {
1616
const formData = await request.formData()
1717
await validateCSRF(formData, request.headers)
1818
checkHoneypot(formData)

exercises/01.schema/01.solution.init/app/routes/resources+/images.$imageId.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import fs from 'node:fs'
22
import { PassThrough } from 'node:stream'
33
import {
44
createReadableStreamFromReadable,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
} from '@remix-run/node'
77
import { db } from '#app/utils/db.server.ts'
88
import { invariantResponse } from '#app/utils/misc.tsx'
99

10-
export async function loader({ params }: DataFunctionArgs) {
10+
export async function loader({ params }: LoaderFunctionArgs) {
1111
invariantResponse(params.imageId, 'Invalid image ID')
1212
const image = db.image.findFirst({
1313
where: { id: { equals: params.imageId } },

exercises/01.schema/01.solution.init/app/routes/users+/$username.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { json, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { Spacer } from '#app/components/spacer.tsx'
55
import { Button } from '#app/components/ui/button.tsx'
66
import { db } from '#app/utils/db.server.ts'
77
import { getUserImgSrc, invariantResponse } from '#app/utils/misc.tsx'
88

9-
export async function loader({ params }: DataFunctionArgs) {
9+
export async function loader({ params }: LoaderFunctionArgs) {
1010
const user = db.user.findFirst({
1111
where: {
1212
username: {

exercises/01.schema/01.solution.init/app/routes/users+/$username_+/notes.$noteId.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
1+
import {
2+
json,
3+
redirect,
4+
type ActionFunctionArgs,
5+
type LoaderFunctionArgs,
6+
} from '@remix-run/node'
27
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
38
import { AuthenticityTokenInput } from 'remix-utils/csrf/react'
49
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
@@ -9,7 +14,7 @@ import { db } from '#app/utils/db.server.ts'
914
import { getNoteImgSrc, invariantResponse } from '#app/utils/misc.tsx'
1015
import { type loader as notesLoader } from './notes.tsx'
1116

12-
export async function loader({ params }: DataFunctionArgs) {
17+
export async function loader({ params }: LoaderFunctionArgs) {
1318
const note = db.note.findFirst({
1419
where: {
1520
id: {
@@ -29,7 +34,7 @@ export async function loader({ params }: DataFunctionArgs) {
2934
})
3035
}
3136

32-
export async function action({ request, params }: DataFunctionArgs) {
37+
export async function action({ request, params }: ActionFunctionArgs) {
3338
invariantResponse(params.noteId, 'noteId param is required')
3439

3540
const formData = await request.formData()

exercises/01.schema/01.solution.init/app/routes/users+/$username_+/notes.$noteId_.edit.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
json,
1313
unstable_parseMultipartFormData as parseMultipartFormData,
1414
redirect,
15-
type DataFunctionArgs,
15+
type ActionFunctionArgs,
16+
type LoaderFunctionArgs,
1617
} from '@remix-run/node'
1718
import { Form, useActionData, useLoaderData } from '@remix-run/react'
1819
import { useRef, useState } from 'react'
@@ -35,7 +36,7 @@ import {
3536
useIsPending,
3637
} from '#app/utils/misc.tsx'
3738

38-
export async function loader({ params }: DataFunctionArgs) {
39+
export async function loader({ params }: LoaderFunctionArgs) {
3940
const note = db.note.findFirst({
4041
where: {
4142
id: {
@@ -79,7 +80,7 @@ const NoteEditorSchema = z.object({
7980
images: z.array(ImageFieldsetSchema).max(5).optional(),
8081
})
8182

82-
export async function action({ request, params }: DataFunctionArgs) {
83+
export async function action({ request, params }: ActionFunctionArgs) {
8384
invariantResponse(params.noteId, 'noteId param is required')
8485

8586
const formData = await parseMultipartFormData(

exercises/01.schema/01.solution.init/app/routes/users+/$username_+/notes.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { json, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { db } from '#app/utils/db.server.ts'
55
import { cn, getUserImgSrc, invariantResponse } from '#app/utils/misc.tsx'
66

7-
export async function loader({ params }: DataFunctionArgs) {
7+
export async function loader({ params }: LoaderFunctionArgs) {
88
const owner = db.user.findFirst({
99
where: {
1010
username: {

exercises/01.schema/01.solution.init/app/routes/users+/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, redirect, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, useLoaderData } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { SearchBar } from '#app/components/search-bar.tsx'
55
import { db } from '#app/utils/db.server.ts'
66
import { cn, getUserImgSrc, useDelayedIsPending } from '#app/utils/misc.tsx'
77

8-
export async function loader({ request }: DataFunctionArgs) {
8+
export async function loader({ request }: LoaderFunctionArgs) {
99
const searchTerm = new URL(request.url).searchParams.get('search')
1010
if (searchTerm === '') {
1111
return redirect('/users')

exercises/02.relationships/01.problem.one-to-many/app/root.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import os from 'node:os'
22
import { cssBundleHref } from '@remix-run/css-bundle'
33
import {
44
json,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
type LinksFunction,
77
} from '@remix-run/node'
88
import {
@@ -38,7 +38,7 @@ export const links: LinksFunction = () => {
3838
].filter(Boolean)
3939
}
4040

41-
export async function loader({ request }: DataFunctionArgs) {
41+
export async function loader({ request }: LoaderFunctionArgs) {
4242
const [csrfToken, csrfCookieHeader] = await csrf.commitToken(request)
4343
const honeyProps = honeypot.getInputProps()
4444
return json(

exercises/02.relationships/01.problem.one-to-many/app/routes/_auth+/signup.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
redirect,
3-
type DataFunctionArgs,
3+
type ActionFunctionArgs,
44
type MetaFunction,
55
} from '@remix-run/node'
66
import { Form } from '@remix-run/react'
@@ -12,7 +12,7 @@ import { Label } from '#app/components/ui/label.tsx'
1212
import { validateCSRF } from '#app/utils/csrf.server.ts'
1313
import { checkHoneypot } from '#app/utils/honeypot.server.ts'
1414

15-
export async function action({ request }: DataFunctionArgs) {
15+
export async function action({ request }: ActionFunctionArgs) {
1616
const formData = await request.formData()
1717
await validateCSRF(formData, request.headers)
1818
checkHoneypot(formData)

exercises/02.relationships/01.problem.one-to-many/app/routes/resources+/images.$imageId.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import fs from 'node:fs'
22
import { PassThrough } from 'node:stream'
33
import {
44
createReadableStreamFromReadable,
5-
type DataFunctionArgs,
5+
type LoaderFunctionArgs,
66
} from '@remix-run/node'
77
import { db } from '#app/utils/db.server.ts'
88
import { invariantResponse } from '#app/utils/misc.tsx'
99

10-
export async function loader({ params }: DataFunctionArgs) {
10+
export async function loader({ params }: LoaderFunctionArgs) {
1111
invariantResponse(params.imageId, 'Invalid image ID')
1212
const image = db.image.findFirst({
1313
where: { id: { equals: params.imageId } },

exercises/02.relationships/01.problem.one-to-many/app/routes/users+/$username.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { json, type DataFunctionArgs } from '@remix-run/node'
1+
import { json, type LoaderFunctionArgs } from '@remix-run/node'
22
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
33
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
44
import { Spacer } from '#app/components/spacer.tsx'
55
import { Button } from '#app/components/ui/button.tsx'
66
import { db } from '#app/utils/db.server.ts'
77
import { getUserImgSrc, invariantResponse } from '#app/utils/misc.tsx'
88

9-
export async function loader({ params }: DataFunctionArgs) {
9+
export async function loader({ params }: LoaderFunctionArgs) {
1010
const user = db.user.findFirst({
1111
where: {
1212
username: {

0 commit comments

Comments
 (0)