Skip to content

Commit ac9d184

Browse files
Fix misalignment in sample codes for data mutation guide (#1150)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 692fd78 commit ac9d184

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/routes/solid-router/reference/data-apis/use-submission.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ When the form is submitted, the `submission` object will be updated with the new
6161
This allows you to provide feedback to the user that the action is in progress.
6262
Once the action is complete, the `pending` property will be set to `false` and the `result` property will be updated with final value.
6363

64-
```tsx tab title="TypeScript" {5,9-11}
64+
```tsx tab title="TypeScript" {6,10-12}
6565
// component.tsx
6666
import { Show } from "solid-js";
6767
import { useSubmission } from "@solidjs/router";
@@ -90,7 +90,7 @@ function Component() {
9090
}
9191
```
9292

93-
```tsx tab title="JavaScript" {5,9-11}
93+
```tsx tab title="JavaScript" {6,10-12}
9494
// component.jsx
9595
import { Show } from "solid-js";
9696
import { useSubmission } from "@solidjs/router";

src/routes/solid-start/guides/data-mutation.mdx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ To handle [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/f
1414
3. Ensure the `<form>` element uses the `post` method for submission.
1515
4. Use the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) object in the action to extract field data using the navite `FormData` methods.
1616

17-
```tsx tab title="TypeScript" {3-9} {13}
17+
```tsx tab title="TypeScript" {4-10} {14}
1818
// src/routes/index.tsx
1919
import { action } from "@solidjs/router";
2020

@@ -36,7 +36,7 @@ export default function Page() {
3636
}
3737
```
3838

39-
```jsx tab title="JavaScript" {3-9} {13}
39+
```jsx tab title="JavaScript" {4-10} {14}
4040
// src/routes/index.jsx
4141
import { action } from "@solidjs/router";
4242

@@ -62,7 +62,7 @@ export default function Page() {
6262

6363
To pass additional arguments to your action, use the `with` method:
6464

65-
```tsx tab title="TypeScript" {14}
65+
```tsx tab title="TypeScript" {15}
6666
// src/routes/index.tsx
6767
import { action } from "@solidjs/router";
6868

@@ -85,7 +85,7 @@ export default function Page() {
8585
}
8686
```
8787

88-
```jsx {14} tab title="JavaScript"
88+
```jsx tab title="JavaScript" {15}
8989
// src/routes/index.jsx
9090
import { action } from "@solidjs/router";
9191

@@ -115,7 +115,7 @@ To display a pending UI during action execution:
115115
1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`.
116116
2. Call `useSubmission` with your action, and use the returned `pending` property to display pending UI.
117117

118-
```tsx tab title="TypeScript" {12} {16-18}
118+
```tsx tab title="TypeScript" {13} {17-19}
119119
// src/routes/index.tsx
120120
import { action, useSubmission } from "@solidjs/router";
121121

@@ -140,7 +140,7 @@ export default function Page() {
140140
}
141141
```
142142

143-
```jsx tab title="JavaScript" {12} {16-18}
143+
```jsx tab title="JavaScript" {13} {17-19}
144144
// src/routes/index.jsx
145145
import { action, useSubmission } from "@solidjs/router";
146146

@@ -172,7 +172,7 @@ To handle errors that occur within an action:
172172
1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`.
173173
2. Call `useSubmission` with your action, and use the returned `error` property to handle the error.
174174

175-
```tsx tab title="TypeScript" {13} {16-18}
175+
```tsx tab title="TypeScript" {14} {17-19}
176176
// src/routes/index.tsx
177177
import { Show } from "solid-js";
178178
import { action, useSubmission } from "@solidjs/router";
@@ -199,7 +199,7 @@ export default function Page() {
199199
}
200200
```
201201

202-
```jsx tab title="JavaScript" {13} {16-18}
202+
```jsx tab title="JavaScript" {14} {17-19}
203203
// src/routes/index.jsx
204204
import { Show } from "solid-js";
205205
import { action, useSubmission } from "@solidjs/router";
@@ -234,7 +234,7 @@ To validate form fields in an action:
234234
2. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`.
235235
3. Call `useSubmission` with your action, and use the returned `result` property to handle the errors.
236236

237-
```tsx tab title="TypeScript" {6-10} {17} {22-24}
237+
```tsx tab title="TypeScript" {7-11} {19} {23-25}
238238
// src/routes/index.tsx
239239
import { Show } from "solid-js";
240240
import { action, useSubmission } from "@solidjs/router";
@@ -266,7 +266,7 @@ export default function Page() {
266266
}
267267
```
268268

269-
```jsx tab title="JavaScript" {6-10} {17} {22-24}
269+
```jsx tab title="JavaScript" {7-11} {19} {23-25}
270270
// src/routes/index.jsx
271271
import { Show } from "solid-js";
272272
import { action, useSubmission } from "@solidjs/router";
@@ -305,7 +305,7 @@ To update the UI before the server responds:
305305
1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`.
306306
2. Call `useSubmission` with your action, and use the returned `pending` and `input` properties to display optimistic UI.
307307
308-
```tsx tab title="TypeScript" {19} {28-30}
308+
```tsx tab title="TypeScript" {20} {29-31}
309309
// src/routes/index.tsx
310310
import { For, Show } from "solid-js";
311311
import { action, useSubmission, query, createAsync } from "@solidjs/router";
@@ -343,7 +343,7 @@ export default function Page() {
343343
}
344344
```
345345
346-
```jsx tab title="JavaScript" {19} {28-30}
346+
```jsx tab title="JavaScript" {20} {29-31}
347347
// src/routes/index.jsx
348348
import { For, Show } from "solid-js";
349349
import { action, useSubmission, query, createAsync } from "@solidjs/router";
@@ -392,7 +392,7 @@ To redirect users to a different route within an action:
392392
1. Import [`redirect`](/solid-router/reference/response-helpers/redirect) from `@solidjs/router`.
393393
2. Call `redirect` with the route you want to navigate to, and throw its response.
394394
395-
```tsx tab title="TypeScript" {10}
395+
```tsx tab title="TypeScript" {11}
396396
// src/routes/index.tsx
397397
import { action, redirect } from "@solidjs/router";
398398

@@ -416,7 +416,7 @@ export default function Page() {
416416
}
417417
```
418418
419-
```jsx tab title="JavaScript" {10}
419+
```jsx tab title="JavaScript" {11}
420420
// src/routes/index.jsx
421421
import { action, redirect } from "@solidjs/router";
422422

@@ -444,7 +444,7 @@ export default function Page() {
444444
445445
To safely interact with your database or ORM in an action, ensure it's server-only by adding [`"use server"`](/solid-start/reference/server/use-server) as the first line of your action:
446446
447-
```tsx tab title="TypeScript" {5}
447+
```tsx tab title="TypeScript" {6}
448448
// src/routes/index.tsx
449449
import { action } from "@solidjs/router";
450450
import { db } from "~/lib/db";
@@ -465,7 +465,7 @@ export default function Page() {
465465
}
466466
```
467467
468-
```jsx tab title="JavaScript" {5}
468+
```jsx tab title="JavaScript" {6}
469469
// src/routes/index.jsx
470470
import { action } from "@solidjs/router";
471471
import { db } from "~/lib/db";
@@ -493,7 +493,7 @@ To programmatically invoke an action:
493493
1. Import [`useAction`](/solid-router/reference/data-apis/use-action) from `@solidjs/router`.
494494
2. Call `useAction` with your action, and use the returned function to invoke the action.
495495
496-
```tsx tab title="TypeScript" {13} {17}
496+
```tsx tab title="TypeScript" {14} {18}
497497
// src/routes/index.tsx
498498
import { createSignal } from "solid-js";
499499
import { action, useAction } from "@solidjs/router";
@@ -517,7 +517,7 @@ export default function Page() {
517517
}
518518
```
519519
520-
```jsx tab title="JavaScript" {13} {17}
520+
```jsx tab title="JavaScript" {14} {18}
521521
// src/routes/index.jsx
522522
import { createSignal } from "solid-js";
523523
import { action, useAction } from "@solidjs/router";

0 commit comments

Comments
 (0)