Skip to content

Commit fccd480

Browse files
committedApr 16, 2024··
docs(website): improve metadata documentation
1 parent 1e55068 commit fccd480

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎website/docs/safe-action-client/initialization-options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ export const actionClient = createSafeActionClient({
8383
});
8484
```
8585

86-
Note that the schema is used just to infer the type of the metadata, and not to validate it:
86+
Note that the schema is used just to infer the type of the metadata, and not to validate it.

‎website/docs/safe-action-client/instance-methods.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ use<const NextCtx>(middlewareFn: MiddlewareFn<ServerError, Ctx, NextCtx, Metadat
2929
metadata(data: Metadata) => { schema() }
3030
```
3131

32-
`metadata` expects an argument of the same type as the return value of the [`defineMetadataSchema`](/docs/safe-action-client/initialization-options#definemetadataschema) optional initialization function. If you don't provide this function to the action client, `metadata` defaults type to `null`. If you don't use this method before defining your action (using [`action`](#action) method), `metadata` will be `null` inside [`serverCodeFn`](#servercodefn). `metadata` lets you specify useful data about the safe action you're executing. It returns the [`schema`](#schema) method, since metadata is action specific and not shared with other actions. You can then access it in the `middlewareFn` passed to [`use`](#use) and in [`serverCodeFn`](#servercodefn) passed to [`action`](#action).
32+
`metadata` expects an argument of the same type as the return value of the [`defineMetadataSchema`](/docs/safe-action-client/initialization-options#definemetadataschema) optional initialization function. If you don't provide this function to the action client when you initialize it, `metadata` will be `null`.
33+
34+
`metadata` lets you specify useful data about the safe action you're executing. If you don't use this method before defining your action (using [`action`](#action) method), `metadata` will be `null` inside [`serverCodeFn`](#servercodefn). It returns the [`schema`](#schema) method, since metadata is action specific and not shared with other actions. You can then access it in the `middlewareFn` passed to [`use`](#use) and in [`serverCodeFn`](#servercodefn) passed to [`action`](#action).
3335

3436
## `schema`
3537

0 commit comments

Comments
 (0)
Please sign in to comment.