You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b109086
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/guide/pages-routing/islands.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -344,7 +344,7 @@ export default function PostForm() {
344
344
345
345
:::
346
346
347
-
`useIslandForm` provides the same form state as [`useForm`](./actions-and-forms#useform). Pass the action URL to `post`, `put`, `patch`, or `delete` to submit.
347
+
`useIslandForm` provides the same form state as [`useForm`](./actions-and-forms#useform). Pass the action URL to `post`, `put`, `patch`, or `delete` to submit. With [`routing.typedRoutes`](../type-safety.md#checked-url-strings), that URL is a [`RouteUrl`](../../reference/api/types.md#route-types). Cast a path built at runtime with `as RouteUrl`.
348
348
349
349
Successful submissions reload the page; redirects navigate to their destination. A `422` response populates `errors` from `{ errors: { field: "message" } }`. Submit helpers return `Promise<void>`.
Copy file name to clipboardExpand all lines: docs/guide/type-safety.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,7 +261,7 @@ export default defineConfig({
261
261
262
262
### Checked URL strings
263
263
264
-
[`routing.typedRoutes`](../reference/config.md#routing-typedroutes) checks plain URL strings in `Link`'s `href`, `router.visit()`, `router.prefetch()`, `router.flush()`, `c.rewrite()`, and `revalidate({ paths })`. Apps created with `void init` have it on. To turn it on in an existing app:
264
+
[`routing.typedRoutes`](../reference/config.md#routing-typedroutes) checks plain URL strings in `Link`'s `href`, `router.visit()`, `router.prefetch()`, `router.flush()`, `c.rewrite()`, `revalidate({ paths })`, and `useIslandForm()`'s `post()`, `put()`, `patch()`, `delete()`, and `submit()`. Apps created with `void init` have it on. To turn it on in an existing app:
`void/routes` exports two types for these strings:
342
342
343
-
-`RouteUrl`: the URL of one of your routes. `routeUrl()` returns it, and `c.rewrite()` and `revalidate({ paths })` accept it. Annotate a `c.redirect()` path or a `routing.prerender` list with it.
343
+
-`RouteUrl`: the URL of one of your routes. `routeUrl()` returns it, and `c.rewrite()`, `useIslandForm()`, and `revalidate({ paths })` accept it. Annotate a `c.redirect()` path or a `routing.prerender` list with it.
344
344
-`Href`: anything a link can point to: a `RouteUrl`, a same-page query or hash, or an external URL.
345
345
346
346
Cast a string that TypeScript can't check, such as a path from your CMS or a file in `public/`. The cast turns the check off for that string:
@@ -405,7 +405,7 @@ Route types update with the dev server. For CI or standalone typechecking, run `
405
405
| Handlers |`c.env` bindings, validator input, return type |
Copy file name to clipboardExpand all lines: docs/guide/typed-fetch.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,8 @@ The client constrains every part of the request:
35
35
-**Body, query, params:** when your handler uses [`defineHandler.withValidator()`](./server-routing.md#validation), validator schemas become the input types and the client enforces them at the call site.
36
36
-**Response type:** the return type matches what your handler returns after [JSON serialization](./type-safety.md#serialization).
37
37
38
+
Omitting `method` sends GET. For a route without a GET handler, specify a supported method, such as `{ method: 'POST' }`.
39
+
38
40
## Query Parameters
39
41
40
42
Pass `query` for GET requests with search parameters:
0 commit comments