Skip to content

Commit 126d2aa

Browse files
amirhhashemikodiakhq[bot]LadyBluenotes
authored
Fix typo (#1107)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Sarah <gerrardsarah@gmail.com>
1 parent 93a0b2c commit 126d2aa

File tree

12 files changed

+40
-58
lines changed

12 files changed

+40
-58
lines changed

src/routes/reference/reactive-utilities/batch.mdx

Lines changed: 18 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ function batch<T>(fn: () => T): T
99
```
1010

1111
`batch` is a low-level API that batches updates together.
12-
More precisely, `batch(fn)` holds the execution of downstream computations
13-
during the `fn` block, executing them all together once the block `fn` returns.
14-
Thus, instead of a downstream computation executing after every dependency
15-
update, it will update just once at the end of the batch.
12+
More precisely, `batch(fn)` holds the execution of downstream computations during the `fn` block, executing them all together once the block `fn` returns.
13+
Thus, instead of a downstream computation executing after every dependency update, it will update just once at the end of the batch.
1614

1715
Batching improves performance by avoiding unnecessary recalculation.
18-
Suppose you have a downstream memo `down` that depends on
19-
multiple upstream signals `up1`, `up2`, and `up3`:
16+
Suppose you have a downstream memo `down` that depends on multiple upstream signals `up1`, `up2`, and `up3`:
2017

2118
```ts
2219
import { createSignal, createMemo, createEffect } from "solid-js"
@@ -28,17 +25,15 @@ const down = createMemo(() => up1() + up2() + up3())
2825
createEffect(() => console.log(down())) // outputs 6
2926
```
3027

31-
If you directly update all of the upstream signals outside of batch mode,
32-
then `down` will recompute every time.
28+
If you directly update all of the upstream signals outside of batch mode, then `down` will recompute every time.
3329

3430
```ts
3531
setUp1(4) // recomputes down, outputs 9
3632
setUp2(5) // recomputes down, outputs 12
3733
setUp3(6) // recomputes down, outputs 15
3834
```
3935

40-
If instead you update the upstream signals within a `batch`, then `down`
41-
will update only once at the end:
36+
If instead you update the upstream signals within a `batch`, then `down` will update only once at the end:
4237

4338
```ts
4439
batch(() => {
@@ -48,33 +43,21 @@ batch(() => {
4843
}) // recomputes down, outputs 30
4944
```
5045

51-
The impact is even more dramatic if you have *m* downstream computations
52-
(memos, effects, etc.) that each depend on *n* upstream signals.
53-
Without batching, modifying all *n* upstream signals
54-
would cause *m n* updates to the downstream computations.
55-
With batching, modifying all *n* upstream signals
56-
would cause *m* updates to the downstream computations.
57-
Given that each update takes at least *n* time
58-
(just to read the upstream signals), this cost savings can be significant.
59-
Batching is also especially helpful when the downstream effects include
60-
DOM updates, which can be expensive.
46+
The impact is even more dramatic if you have *m* downstream computations (memos, effects, etc.) that each depends on *n* upstream signals.
47+
Without batching, modifying all *n* upstream signals would cause *m n* updates to the downstream computations.
48+
With batching, modifying all *n* upstream signals would cause *m* updates to the downstream computations.
49+
Given that each update takes at least *n* time (just to read the upstream signals), this cost savings can be significant.
50+
Batching is also especially helpful when the downstream effects include DOM updates, which can be expensive.
6151

62-
Solid uses `batch` internally to automatically batch updates for you
63-
in a few cases:
52+
Solid uses `batch` internally to automatically batch updates for you in a few cases:
6453

65-
* Within [`createEffect`](/reference/basic-reactivity/create-effect)
66-
and [`onMount`](/reference/lifecycle/on-mount)
67-
(unless they are outside a [root](/reference/reactive-utilities/create-root))
68-
* Within the [setter of a store](/reference/store-utilities/create-store#setter)
69-
(which can update several properties at once)
70-
* Within array methods (e.g. `Array.prototype.splice`) of a
71-
[mutable store](/reference/store-utilities/create-mutable)
72-
(which can update several elements at once)
54+
* Within [`createEffect`](/reference/basic-reactivity/create-effect) and [`onMount`](/reference/lifecycle/on-mount) (unless they are outside a [root](/reference/reactive-utilities/create-root))
55+
* Within the [setter of a store](/reference/store-utilities/create-store#setter) (which can update several properties at once)
56+
* Within array methods (e.g. `Array.prototype.splice`) of a [mutable store](/reference/store-utilities/create-mutable) (which can update several elements at once)
7357

7458
These save you from having to use `batch` yourself in many cases.
75-
For the most part, automatic batching should be transparent to you,
76-
because accessing a signal or memo will cause it to update if it is out of date
77-
(as of Solid 1.4). For example:
59+
For the most part, automatic batching should be transparent to you, because accessing a signal or memo will cause it to update if it is out of date (as of Solid 1.4).
60+
For example:
7861

7962
```ts
8063
batch(() => {
@@ -88,9 +71,6 @@ batch(() => {
8871
}) // recomputes down, outputs 36
8972
```
9073

91-
You can think of `batch(fn)` as setting a global "batch mode" variable,
92-
calling the function `fn`, and then restoring the global variable to its
93-
previous value.
74+
You can think of `batch(fn)` as setting a global "batch mode" variable, calling the function `fn`, and then restoring the global variable to its previous value.
9475
This means that you can nest `batch` calls, and they will form one big batch.
95-
It also means that, if `fn` is asynchronous,
96-
only the updates before the first `await` will be batched.
76+
It also means that, if `fn` is asynchronous, only the updates before the first `await` will be batched.

src/routes/solid-router/concepts/actions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Actions are Solid Router’s solution to this problem.
99

1010
Actions are asynchronous processing functions that allow you to submit data to your server and receive a response.
1111
They are isomorphic, meaning they can run either on the server or the client, depending on what is needed.
12-
This flexibility makes actions a powerful tool for managing and tracking data submission.
12+
This flexibility makes actions a powerful tool for managing and tracking data submissions.
1313

1414
### How actions work
1515

src/routes/solid-router/concepts/alternative-routers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ render(
3838

3939
## Memory mode
4040

41-
Unlike the default router and hash, memory router does not interact with the browser's URL.
41+
Unlike the default router and hash, the memory router does not interact with the browser's URL.
4242
This means that while the URL in the browser's address bar will change, the router will not navigate to the new route.
4343
This gives you the ability to control the router's state and history in memory which can be useful for testing purposes.
4444

src/routes/solid-router/concepts/catch-all.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Catch-all routes
55
Catch-all routes are used to match any URL that does not match any other route in the application.
66
This is useful for displaying a 404 page or redirecting to a specific route when a user enters an invalid URL.
77

8-
To create a catch-all route, place a route with a asteriks `*` as the path at the end of the route list.
8+
To create a catch-all route, place a route with an asterisk (`*`) as the path at the end of the route list.
99
Optionally, you can name the parameter to access the unmatched part of the URL.
1010

1111
```jsx
@@ -24,4 +24,4 @@ const App = () => (
2424
);
2525
```
2626

27-
Now, if a user navigates to a URL that does not match `/home` or `/about`, the `NotFound` component will be rendered.
27+
Now, if a user navigates to a URL that does not match `/home` or `/about`, the `NotFound` component will be rendered.

src/routes/solid-router/concepts/layouts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ render(
3737
);
3838
```
3939

40-
With the root-level layout, `props.children` will be replaced with the content of current route.
40+
With the root-level layout, `props.children` will be replaced with the content of the current route.
4141
This means that while the words "Header" and "Footer" will be displayed on every page, the content between them will change depending on the current route.
4242
For example, when the route is `/hello-world`, you will see the text "Hello world!" between the header and footer.
4343

src/routes/solid-start/building-your-application/api-routes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ While Server Functions can be a good way to write server-side code for data need
66
Some reasons for wanting API Routes include:
77
- There are additional clients that want to share this logic.
88
- Exposing a GraphQL or tRPC endpoint.
9-
- Exposing a public facing REST API.
9+
- Exposing a public-facing REST API.
1010
- Writing webhooks or auth callback handlers for OAuth.
1111
- Having URLs not serving HTML, but other kinds of documents like PDFs or images.
1212

src/routes/solid-start/building-your-application/css-and-styling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ This is because, behind the scenes, classes defined in CSS modules are renamed t
7878
When classes are hard coded using the class attribute (`class="card"`), Solid is not aware that it should rename `card` to something different.
7979

8080
To fix this, you can import classes used in your CSS module.
81-
The import object can be thought of as `humanClass: generatedClass` and within the component, they key (ie. the class on the element) is used to get the unique, generated class name.
81+
The import object can be thought of as `humanClass: generatedClass` and within the component, the key (ie. the class on the element) is used to get the unique, generated class name.
8282

8383
```jsx
8484
import styles from "./Card.module.css";

src/routes/solid-start/building-your-application/head-and-metadata.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function About() {
3838
These tags will be applied for that specific route only and will be removed from `document.head` once a user navigates away from the page.
3939
`routeData` can also be used here to create titles and SEO metadata that is specific to the dynamic parts of the route.
4040

41-
## Adding a site-suffix in Title
41+
## Adding a site suffix in Title
4242

4343
Custom components can be created to wrap the `Title` component to add a site-specific prefix to all the titles:
4444

@@ -112,7 +112,7 @@ export default function Root() {
112112
}
113113
```
114114

115-
If you need to add route specific information inside your route, much like the `Title` component, you can use the `Meta` component within the desired route.
115+
If you need to add route-specific information inside your route, much like the `Title` component, you can use the `Meta` component within the desired route.
116116
This overrides the `Meta` tags used within the `Head` component.
117117

118118
```tsx

src/routes/solid-start/building-your-application/route-prerendering.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Route pre-rendering"
33
---
44

55
SolidStart offers a way to pre-render pages at build time.
6-
The easiest way to accomplish this, is by passing a list of routes to be pre-rendered to the `routes` option.
6+
The easiest way to accomplish this is by passing a list of routes to be pre-rendered to the `routes` option.
77

88
```js { 6 }
99
import { defineConfig } from "@solidjs/start/config";
@@ -31,4 +31,4 @@ export default defineConfig({
3131
});
3232
```
3333

34-
For more information on prerender options, check out [Nitro's documentation](https://nitro.unjs.io/config#prerender)
34+
For more information on prerender options, check out [Nitro's documentation](https://nitro.unjs.io/config#prerender)

src/routes/solid-start/building-your-application/routing.mdx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Routing"
33
---
44

5-
Routing serves as a key component to web applications.
5+
Routing serves as a key component of web applications.
66
Within SolidStart, there are two types:
77

88
- **UI routes** &mdash; define the user interface in your app
@@ -16,11 +16,11 @@ SolidStart uses file based routing which is a way of defining your routes by cre
1616
This includes your pages and API routes.
1717

1818
SolidStart traverses your `routes` directory, collects all of the routes, and then makes them accessible using the [`<FileRoutes />`](/solid-start/reference/routing/file-routes).
19-
This component will only include your UI routes, and not your API routes.
19+
This component will only include your UI routes, not your API routes.
2020
Rather than manually defining each `Route` inside a `Router` component, `<FileRoutes />` will generate the routes for you based on the file system.
2121

2222
Because `<FileRoutes />` returns a routing config object, you can use it with the router of your choice.
23-
In this example we use [`solid-router`](/solid-router):
23+
In this example, we use [`solid-router`](/solid-router):
2424

2525
```tsx {7-9} title="app.tsx"
2626
import { Suspense } from "solid-js";
@@ -37,7 +37,8 @@ export default function App() {
3737
```
3838

3939
The `<Router />` component expects a `root` prop which functions as the root layout of your entire app.
40-
You will want to make sure `props.children` is wrapped in `<Suspense />` because each component will be lazy loaded automatically for you. Without this you may see some unexpected hydration errors.
40+
You will want to make sure `props.children` is wrapped in `<Suspense />` since each component will be lazy-loaded automatically.
41+
Without this, you could see some unexpected hydration errors.
4142

4243
`<FileRoutes />` will generate a route for each file in the `routes` directory and its subdirectories. For a route to be rendered as a page, it must default export a component.
4344
This component represents the content that will be rendered when users visit the page:
@@ -84,7 +85,8 @@ If you want to create nested layouts you can create a file with the same name as
8485
|-- article-2.tsx // example.com/blog/article-2
8586
```
8687

87-
In this case the `blog.tsx` file will act as a layout for the articles in the `blog` folder. You can reference the child content
88+
In this case, the `blog.tsx` file will act as a layout for the articles in the `blog` folder.
89+
You can reference the child's content
8890
by using `props.children` in the layout.
8991

9092
<TabsCodeBlocks>
@@ -113,7 +115,7 @@ export default function BlogLayout(props) {
113115
By default, the component that is rendered for a route comes from the default export of the `index.tsx` file in each folder.
114116
However, this can make it difficult to find the correct `index.tsx` file when searching, since there will be multiple files with that name.
115117

116-
To avoid this, you can rename the `index.tsx` file to the name of the folder it is in, enclosed in parenthesis.
118+
To avoid this, you can rename the `index.tsx` file to the name of the folder it is in, enclosed in parentheses.
117119

118120
This way, it will be treated as the default export for that route:
119121

0 commit comments

Comments
 (0)