Skip to content

Commit

Permalink
clarify that mutations should not be sent to the client
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsender committed Oct 3, 2023
1 parent 926a23a commit 2e0232f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apps/web/app/routes/get-started.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ export default function Component() {
<p>
Compose a zod schema that will be used in your action, mutation
function, form generation, server-side validation, and client-side
validation. You can do this in a route where you'll be submitting form.
validation. You can either do this in a route where you'll be submitting
a form or somewhere in your app directory of your choosing, like:
</p>
<Pre>/app/schemas/schemaName.ts</Pre>
<Code>{schemaCode}</Code>
<SubHeading>Create your mutation</SubHeading>
<p>
Expand All @@ -247,8 +249,15 @@ export default function Component() {
<p>
Domain Functions will parse the request&apos;s <em>formData</em> and
perform the mutation only if everything is valid. If something goes bad,
it will return structured error messages for us. You can also put this
in the route where you'll be submitting a form.
it will return structured error messages for us. We typically use
mutations in our actions, which we'll set up in the next step. You don't
want your mutation to be sent to the client since it will usually have
server side code, so you can choose to put them in a separate file like
</p>
<Pre>/app/domain/some-domain.ts</Pre>
<p>
and import the domain for use in your action, or write your mutation
inline in the <em>formAction</em> in the following step.
</p>
<Code>{mutationCode}</Code>
<SubHeading>Create your action</SubHeading>
Expand Down

0 comments on commit 2e0232f

Please sign in to comment.