Skip to content

Commit 4bb7e48

Browse files
committed
Revert "Support direct handlers in useSubmit/fetcher.submit/fetcher.load (#10362)"
This reverts commit 4357e37.
1 parent 5d45497 commit 4bb7e48

File tree

10 files changed

+79
-822
lines changed

10 files changed

+79
-822
lines changed

.changeset/direct-handlers-router.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

.changeset/direct-handlers.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

docs/hooks/use-fetcher.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ If you find yourself calling this function inside of click handlers, you can pro
108108

109109
<docs-info>Any `fetcher.load` calls that are active on the page will be re-executed as part of revalidation (either after a navigation submission, another fetcher submission, or a `useRevalidator()` call)</docs-info>
110110

111-
### Direct `loader` specification
112-
113-
If you want to perform a `fetcher.load`, but you don't want/need to create a route for your `loader`, you can pass a `loader` directly to `fetcher.load`:
114-
115-
```tsx
116-
fetcher.load(() => {
117-
// Custom loader implementation here
118-
});
119-
```
120-
121111
## `fetcher.submit()`
122112

123113
The imperative version of `<fetcher.Form>`. If a user interaction should initiate the fetch, you should use `<fetcher.Form>`. But if you, the programmer are initiating the fetch (not in response to a user clicking a button, etc.), then use this function.
@@ -149,18 +139,6 @@ If you want to submit to an index route, use the [`?index` param][indexsearchpar
149139

150140
If you find yourself calling this function inside of click handlers, you can probably simplify your code by using `<fetcher.Form>` instead.
151141

152-
### Direct `action` specification
153-
154-
If you want to perform a `fetcher.submit`, but you don't want/need to create a route for your `action`, you can pass an `action` directly to `fetcher.submit`:
155-
156-
```tsx
157-
fetcher.submit(data, {
158-
action({ payload }) {
159-
// Custom action implementation here
160-
},
161-
});
162-
```
163-
164142
## `fetcher.data`
165143

166144
The returned data from the loader or action is stored here. Once the data is set, it persists on the fetcher even through reloads and resubmissions.

docs/hooks/use-submit.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function action({ request, payload }) {
124124

125125
## Submit options
126126

127-
The second argument is a set of options that map (mostly) directly to form submission attributes:
127+
The second argument is a set of options that map directly to form submission attributes:
128128

129129
```tsx
130130
submit(null, {
@@ -136,16 +136,4 @@ submit(null, {
136136
<Form action="/logout" method="post" />;
137137
```
138138

139-
### Direct `action` specification
140-
141-
If you want to perform a submission, but you don't want/need to create a route for your `action`, you can pass an `action` to `useSubmit` which will perform a submission navigation to the current location but will use the provided `action`:
142-
143-
```tsx
144-
submit(data, {
145-
action({ request }) {
146-
// Custom action implementation here
147-
},
148-
});
149-
```
150-
151139
[pickingarouter]: ../routers/picking-a-router

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
},
106106
"filesize": {
107107
"packages/router/dist/router.umd.min.js": {
108-
"none": "45.8 kB"
108+
"none": "45 kB"
109109
},
110110
"packages/react-router/dist/react-router.production.min.js": {
111111
"none": "13.1 kB"

0 commit comments

Comments
 (0)