Skip to content

Commit 5577881

Browse files
Update (snippets) to use RR7 (#899)
Co-authored-by: Kent C. Dodds <[email protected]>
1 parent 21e6517 commit 5577881

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

.vscode/remix.code-snippets

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
"prefix": "/loader",
44
"scope": "typescriptreact,javascriptreact,typescript,javascript",
55
"body": [
6-
"import { type LoaderFunctionArgs, json } from \"@remix-run/node\"",
6+
"import { type Route } from \"./+types/${TM_FILENAME_BASE}.ts\"",
77
"",
8-
"export async function loader({ request }: LoaderFunctionArgs) {",
9-
" return json({})",
8+
"export async function loader({ request }: Route.LoaderArgs) {",
9+
" return {}",
1010
"}",
1111
],
1212
},
1313
"action": {
1414
"prefix": "/action",
1515
"scope": "typescriptreact,javascriptreact,typescript,javascript",
1616
"body": [
17-
"import { type ActionFunctionArgs, json } from \"@remix-run/node\"",
17+
"import { type Route } from \"./+types/${TM_FILENAME_BASE}.ts\"",
1818
"",
19-
"export async function action({ request }: ActionFunctionArgs) {",
20-
" return json({})",
19+
"export async function action({ request }: Route.ActionArgs) {",
20+
" return {}",
2121
"}",
2222
],
2323
},
@@ -38,20 +38,19 @@
3838
"prefix": "/headers",
3939
"scope": "typescriptreact,javascriptreact,typescript,javascript",
4040
"body": [
41-
"import type { HeadersFunction } from '@remix-run/node'",
42-
"",
43-
"export const headers: HeadersFunction = ({ loaderHeaders }) => ({",
44-
" 'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',",
41+
"import { type Route } from \"./+types/${TM_FILENAME_BASE}.ts\"",
42+
"export const headers: Route.HeadersFunction = ({ loaderHeaders }) => ({",
43+
" 'Cache-Control': loaderHeaders.get('Cache-Control') ?? '',",
4544
"})",
4645
],
4746
},
4847
"links": {
4948
"prefix": "/links",
5049
"scope": "typescriptreact,javascriptreact,typescript,javascript",
5150
"body": [
52-
"import type { LinksFunction } from '@remix-run/node'",
51+
"import { type Route } from \"./+types/${TM_FILENAME_BASE}.ts\"",
5352
"",
54-
"export const links: LinksFunction = () => {",
53+
"export const links: Route.LinksFunction = () => {",
5554
" return []",
5655
"}",
5756
],
@@ -60,9 +59,9 @@
6059
"prefix": "/meta",
6160
"scope": "typescriptreact,javascriptreact,typescript,javascript",
6261
"body": [
63-
"import type { MetaFunction } from '@remix-run/node'",
62+
"import { type Route } from \"./+types/${TM_FILENAME_BASE}.ts\"",
6463
"",
65-
"export const meta: MetaFunction<typeof loader> = ({ data }) => [{",
64+
"export const meta: Route.MetaFunction = ({ data }) => [{",
6665
" title: 'Title',",
6766
"}]",
6867
],
@@ -71,13 +70,11 @@
7170
"prefix": "/shouldRevalidate",
7271
"scope": "typescriptreact,javascriptreact,typescript,javascript",
7372
"body": [
74-
"import type { ShouldRevalidateFunction } from '@remix-run/react'",
73+
"import { type ShouldRevalidateFunctionArgs } from 'react-router'",
7574
"",
76-
"export const shouldRevalidate: ShouldRevalidateFunction = ({",
77-
" defaultShouldRevalidate",
78-
"}) => {",
75+
"export function shouldRevalidate({ defaultShouldRevalidate }: ShouldRevalidateFunctionArgs) {",
7976
" return defaultShouldRevalidate",
8077
"}",
8178
],
8279
},
83-
}
80+
}

0 commit comments

Comments
 (0)