Skip to content

Commit

Permalink
replace DataFunctionArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Jul 3, 2024
1 parent 1b50501 commit d78d371
Show file tree
Hide file tree
Showing 226 changed files with 890 additions and 534 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changelog

This file will keep track of significant changes that have happened in the
workshop material that is different from what you'll see in the videos.

## DataFunctionArgs

`DataFunctionArgs` was deprecated in Remix and will be removed in the future. It
is recommended to use `LoaderFunctionArgs` and `ActionFunctionArgs` instead
which are the exact same.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const user = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
} from '@remix-run/node'
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -7,7 +12,7 @@ import { db } from '#app/utils/db.server.ts'
import { invariantResponse } from '#app/utils/misc.tsx'
import { type loader as notesLoader } from './notes.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -23,7 +28,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type ActionFunctionArgs,
type LoaderFunctionArgs,
} from '@remix-run/node'
import { Form, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -10,7 +15,7 @@ import { Textarea } from '#app/components/ui/textarea.tsx'
import { db, updateNote } from '#app/utils/db.server.ts'
import { invariantResponse, useIsSubmitting } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -26,7 +31,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'
import { cn } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const owner = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const user = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
} from '@remix-run/node'
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -7,7 +12,7 @@ import { db } from '#app/utils/db.server.ts'
import { invariantResponse } from '#app/utils/misc.tsx'
import { type loader as notesLoader } from './notes.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -23,7 +28,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type ActionFunctionArgs,
type LoaderFunctionArgs,
} from '@remix-run/node'
import { Form, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -10,7 +15,7 @@ import { Textarea } from '#app/components/ui/textarea.tsx'
import { db, updateNote } from '#app/utils/db.server.ts'
import { invariantResponse, useIsSubmitting } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -26,7 +31,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'
import { cn } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const owner = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ very similar to `useLoaderData` with the exception that it will return
`undefined` until the `action` has been called. Here's an example of that:

```tsx filename=app/routes/subscribe.tsx lines=2,4-9,15-36,44,46-49,56-62
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import { json, redirect, type ActionFunctionArgs } from '@remix-run/node'
import { useActionData } from '@remix-run/react'

type ActionErrors = {
Expand All @@ -24,7 +24,7 @@ type ActionErrors = {
}
}

export async function action({ request }: DataFunctionArgs) {
export async function action({ request }: ActionFunctionArgs) {
const formData = await request.formData()
const email = formData.get('email')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const user = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
} from '@remix-run/node'
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -7,7 +12,7 @@ import { db } from '#app/utils/db.server.ts'
import { invariantResponse } from '#app/utils/misc.tsx'
import { type loader as notesLoader } from './notes.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -23,7 +28,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type ActionFunctionArgs,
type LoaderFunctionArgs,
} from '@remix-run/node'
import { Form, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -10,7 +15,7 @@ import { Textarea } from '#app/components/ui/textarea.tsx'
import { db, updateNote } from '#app/utils/db.server.ts'
import { invariantResponse, useIsSubmitting } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -26,7 +31,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'
import { cn } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const owner = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const user = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type LoaderFunctionArgs,
type ActionFunctionArgs,
} from '@remix-run/node'
import { Form, Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -7,7 +12,7 @@ import { db } from '#app/utils/db.server.ts'
import { invariantResponse } from '#app/utils/misc.tsx'
import { type loader as notesLoader } from './notes.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -23,7 +28,7 @@ export async function loader({ params }: DataFunctionArgs) {
})
}

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { json, redirect, type DataFunctionArgs } from '@remix-run/node'
import {
json,
redirect,
type ActionFunctionArgs,
type LoaderFunctionArgs,
} from '@remix-run/node'
import { Form, useActionData, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
Expand All @@ -10,7 +15,7 @@ import { Textarea } from '#app/components/ui/textarea.tsx'
import { db, updateNote } from '#app/utils/db.server.ts'
import { invariantResponse, useIsSubmitting } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const note = db.note.findFirst({
where: {
id: {
Expand All @@ -37,7 +42,7 @@ type ActionErrors = {
const titleMaxLength = 100
const contentMaxLength = 10000

export async function action({ request, params }: DataFunctionArgs) {
export async function action({ request, params }: ActionFunctionArgs) {
invariantResponse(params.noteId, 'noteId param is required')

const formData = await request.formData()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, NavLink, Outlet, useLoaderData } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'
import { cn } from '#app/utils/misc.tsx'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const owner = db.user.findFirst({
where: {
username: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { json, type DataFunctionArgs } from '@remix-run/node'
import { json, type LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData, type MetaFunction } from '@remix-run/react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { db } from '#app/utils/db.server.ts'

export async function loader({ params }: DataFunctionArgs) {
export async function loader({ params }: LoaderFunctionArgs) {
const user = db.user.findFirst({
where: {
username: {
Expand Down
Loading

0 comments on commit d78d371

Please sign in to comment.