@rsc-kit/mcp 0.43.1 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,8 +91,8 @@ with `"use client"` and receives `orders` as props, exactly as before; if it
91
91
  only displays, it needs nothing and ships no JavaScript.
92
92
 
93
93
  The controller method's body is the `Orders::recent()` on the PHP side —
94
- resolved through the container, so constructor injection works, and running
95
- as the visitor. A `#[Authenticated]` or `#[Can]` attribute on it is a refusal
94
+ resolved through the container, so constructor and method injection work, and running
95
+ as the visitor. A `#[Middleware]` or `#[Authorize]` attribute on it is a refusal
96
96
  that reaches the page as itself, never as a broken render.
97
97
 
98
98
  ## Shared data
@@ -129,7 +129,7 @@ php artisan make:rsc-action Orders --method=create --auth --revalidate=orders
129
129
  ```php title="app/Rsc/Actions/Orders.php"
130
130
  class Orders
131
131
  {
132
- #[Authenticated]
132
+ #[Middleware('auth')]
133
133
  public function create(StoreOrder $request): Order
134
134
  {
135
135
  $order = $request->user()->orders()->create($request->validated());
package/guides/errors.md CHANGED
@@ -44,6 +44,10 @@ the page was, with the layouts around it kept and a **Try again** button. In
44
44
  development it shows the message and stack; in production, "Something went
45
45
  wrong" and the digest to search the server log for.
46
46
 
47
+ In development, a page that throws also opens Vite's error overlay, whether an
48
+ `error.tsx` caught it or the engine's page did. That includes a page you
49
+ reached by a link or a redirect, not only one you reloaded.
50
+
47
51
  ### Trying again
48
52
 
49
53
  `reset()` asks the server for the page again and renders the answer. It suits
package/guides/forms.md CHANGED
@@ -88,12 +88,12 @@ What the render function receives:
88
88
  | `fields` | Field names, for a form whose values aren't posted fields. |
89
89
  | `resetOnSuccess` | Reset the form after a successful submit. Default `true`. |
90
90
  | `optimistic` | Called inside the transition, for [optimistic updates](#optimistic-updates). |
91
- | `onSuccess` | Called with the action's result. |
91
+ | `onSuccess` | Called with the action's result. Not after a redirect, unless it [came back to this page](/guides/redirects#back-to-the-same-page). |
92
92
  | `onError` | Called with the validation errors on a 422. |
93
93
  | `onSubmit` | Called before submitting. Return `false` to cancel. |
94
94
  | `prefetch` | `"hover"` (default), `"mount"` or `"none"`. GET forms only. |
95
95
  | `replace` | Replace the history entry. GET forms only. |
96
- | `preserveScroll` | Keep the scroll position. GET forms only. |
96
+ | `preserveScroll` | Keep the scroll position. GET forms only: an action that redirects back to the page it was posted from always keeps it. |
97
97
 
98
98
  ### In a component of its own
99
99
 
@@ -388,8 +388,12 @@ There's nothing to turn on. The actions that can be asked:
388
388
  first answer says so.
389
389
 
390
390
  A field the browser's schema already refuses isn't sent. A field left without
391
- being changed isn't asked about again. A file is sent only when its own field
392
- is the one being checked.
391
+ being changed isn't asked about again. A field left for the form's own submit
392
+ button isn't asked about either: the submit checks every field. A file is sent
393
+ only when its own field is the one being checked.
394
+
395
+ A check runs the action's guards, so a check counts against a `throttle` on
396
+ the action as a submit does.
393
397
 
394
398
  #### When a blur is not the moment
395
399
 
@@ -120,6 +120,15 @@ reload. A named section counts too, since it can live in a layout. For a
120
120
  backend action it is `Rsc::revalidate('all')` before the redirect. A `<Form>`
121
121
  shows nothing for a redirect: arriving is the success.
122
122
 
123
+ ### Back to the same page
124
+
125
+ A redirect back to the page the action was called from is the action
126
+ succeeding, not the visitor leaving. It is how a Laravel action answers a save
127
+ (`back()`), and how Fortify answers enabling two-factor authentication. The page
128
+ renders again, and the `<Form>` or `useAction` that called it settles as a
129
+ success: `onSuccess` runs and `resetOnSuccess` resets. The path and the query
130
+ have to match. A different query, such as `?page=2`, counts as another page.
131
+
123
132
  ### Checking for a redirect in the caller
124
133
 
125
134
  A redirected action **resolves** with `{ redirected: '/where' }` instead of
@@ -260,6 +260,9 @@ export function Posts({ posts }) {
260
260
  - `onSuccess` gets what the handler returned. `onError` gets the
261
261
  `serverError`, or the first validation message. `onSettled` runs after
262
262
  either.
263
+ - A backend's generated stub works the same way:
264
+ `useAction(verification.send)`. `onSuccess` gets what the backend returned,
265
+ and a refusal reaches `onError`.
263
266
  - `optimistic` runs inside the transition, before the call. A failed action
264
267
  undoes it on its own, because the optimistic state ends with the transition.
265
268
  - Neither call throws. Anything thrown on the way, the network included,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsc-kit/mcp",
3
- "version": "0.43.1",
3
+ "version": "0.45.0",
4
4
  "description": "An MCP server over what an rsc-kit build decided: the routes, why each one is static or not, and what it costs the browser.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.30.0",
37
- "create-rsc-kit": "^0.43.1",
37
+ "create-rsc-kit": "^0.45.0",
38
38
  "zod": "^3.25"
39
39
  },
40
40
  "devDependencies": {