Skip to content

Commit 260ca79

Browse files
LadyBluenoteskodiakhq[bot]autofix-ci[bot]
authored
Reference section updates updates (#1460)
* docs: enhance documentation for batch, onCleanup, onMount, and untrack * docs: update descriptions for batch, catchError, getOwner, onCleanup, onMount, runWithOwner, and untrack * docs: update documentation for createReaction, startTransition, and useTransition * docs: update documentation for from, indexArray, mapArray, and observable * docs: refine documentation for children, createContext, useContext, and related APIs * docs: update documentation for createContext, createDeferred, createReaction, createSelector, indexArray, and mapArray * docs: update documentation for <Dynamic>, mergeProps, <Portal>, and splitProps * docs: update documentation for <Dynamic>, mergeProps, <Portal>, and splitProps * docs: update documentation for <Dynamic>, mergeProps, <Portal>, and splitProps * migrate rendering reference pages and split isDev * migrate server rendering reference pages * migrate server rendering reference pages * migrate store creation and mutable store refs * migrate store creation and mutable store refs * migrate jsx attribute refs and attribute directives * add warning to suspense list * jsx styling and content attribute refs * jsx event and directive reference pages * update children * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * ci: apply automated fixes * update * ci: apply automated fixes * update * update * ci: apply automated fixes * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * improve accuracy of docs * ci: apply automated fixes * update docs for accuracy * update docs for accuracy * update docs for accuracy * update docs for accuracy * update docs for accuracy * update docs for accuracy * update children page example * revert router update * ci: apply automated fixes * update prettier ignore * rm class page reference --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 9b39632 commit 260ca79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3556
-1707
lines changed

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
dist
33
*.min.*
44
package-lock.json
5-
.github/ISSUE_TEMPLATE/OTHER.yml
5+
.github

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@solid-primitives/media": "^2.3.5",
2828
"@solid-primitives/platform": "^0.2.1",
2929
"@solidjs/meta": "^0.29.4",
30-
"@solidjs/router": "^0.16.1",
30+
"@solidjs/router": "^0.15.4",
3131
"@solidjs/start": "^1.3.2",
3232
"dotenv": "^17.3.1",
3333
"glob": "^13.0.6",

pnpm-lock.yaml

Lines changed: 2 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/llms.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
- [<Suspense>](https://docs.solidjs.com/reference/components/suspense)
7272
- [<SuspenseList>](https://docs.solidjs.com/reference/components/suspense-list)
7373
- [<Switch> / <Match>](https://docs.solidjs.com/reference/components/switch-and-match)
74+
- [createDynamic](https://docs.solidjs.com/reference/components/create-dynamic)
7475
- [@once](https://docs.solidjs.com/reference/jsx-attributes/once)
7576
- [attr:*](https://docs.solidjs.com/reference/jsx-attributes/attr)
7677
- [bool:*](https://docs.solidjs.com/reference/jsx-attributes/bool)
@@ -103,6 +104,7 @@
103104
- [DEV](https://docs.solidjs.com/reference/rendering/dev)
104105
- [hydrate](https://docs.solidjs.com/reference/rendering/hydrate)
105106
- [hydrationScript](https://docs.solidjs.com/reference/rendering/hydration-script)
107+
- [isDev](https://docs.solidjs.com/reference/rendering/is-dev)
106108
- [isServer](https://docs.solidjs.com/reference/rendering/is-server)
107109
- [render](https://docs.solidjs.com/reference/rendering/render)
108110
- [renderToStream](https://docs.solidjs.com/reference/rendering/render-to-stream)
@@ -125,6 +127,7 @@
125127

126128
- [Overview](https://docs.solidjs.com/solid-start/)
127129
- [Getting started](https://docs.solidjs.com/solid-start/getting-started)
130+
- [Migrating from v1](https://docs.solidjs.com/solid-start/migrating-from-v1)
128131
- [Routing](https://docs.solidjs.com/solid-start/building-your-application/routing)
129132
- [API routes](https://docs.solidjs.com/solid-start/building-your-application/api-routes)
130133
- [CSS and styling](https://docs.solidjs.com/solid-start/building-your-application/css-and-styling)
@@ -137,6 +140,7 @@
137140
- [Sessions](https://docs.solidjs.com/solid-start/advanced/session)
138141
- [Request events](https://docs.solidjs.com/solid-start/advanced/request-events)
139142
- [Returning responses](https://docs.solidjs.com/solid-start/advanced/return-responses)
143+
- [Serialization](https://docs.solidjs.com/solid-start/advanced/serialization)
140144
- [Auth](https://docs.solidjs.com/solid-start/advanced/auth)
141145
- [WebSocket endpoint](https://docs.solidjs.com/solid-start/advanced/websocket)
142146
- [Security](https://docs.solidjs.com/solid-start/guides/security)
@@ -182,6 +186,7 @@
182186
- [Revalidation](https://docs.solidjs.com/solid-router/data-fetching/revalidation)
183187
- [Preload data](https://docs.solidjs.com/solid-router/data-fetching/how-to/preload-data)
184188
- [Handle pending and error states](https://docs.solidjs.com/solid-router/data-fetching/how-to/handle-error-and-loading-states)
189+
- [Preloading](https://docs.solidjs.com/solid-router/advanced-concepts/preloading)
185190
- [Lazy loading](https://docs.solidjs.com/solid-router/advanced-concepts/lazy-loading)
186191
- [Migration from v0.9.x](https://docs.solidjs.com/solid-router/guides/migration)
187192
- [A](https://docs.solidjs.com/solid-router/reference/components/a)
@@ -225,3 +230,4 @@
225230
- [MetaProvider](https://docs.solidjs.com/solid-meta/reference/meta/metaprovider)
226231
- [Style](https://docs.solidjs.com/solid-meta/reference/meta/style)
227232
- [Title](https://docs.solidjs.com/solid-meta/reference/meta/title)
233+
- [useHead](https://docs.solidjs.com/solid-meta/reference/meta/use-head)

src/routes/reference/component-apis/children.mdx

Lines changed: 34 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ tags:
1010
- utilities
1111
version: "1.0"
1212
description: >-
13-
Resolve and normalize a component's `children` prop into a stable accessor.
14-
Useful when you need to read or transform children imperatively inside a
15-
component.
13+
Resolve a component's `children` prop into a stable accessor.
1614
---
1715

18-
`children` normalizes a component's `children` prop into a stable accessor that returns resolved JSX elements.
19-
It accepts functions, arrays, fragments, and nested structures.
16+
`children` resolves a component's `children` prop and returns a stable accessor for the resolved result.
2017

2118
## Import
2219

@@ -27,10 +24,11 @@ import { children } from "solid-js";
2724
## Type
2825

2926
```ts
30-
function children(fn: Accessor<JSX.Element>): ChildrenReturn;
27+
type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
28+
type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
3129

32-
type ChildrenReturn = Accessor<ResolvedChildren> & {
33-
toArray: () => ResolvedChildren[];
30+
function children(fn: Accessor<JSX.Element>): Accessor<ResolvedChildren> & {
31+
toArray: () => ResolvedJSXElement[];
3432
};
3533
```
3634

@@ -41,24 +39,20 @@ type ChildrenReturn = Accessor<ResolvedChildren> & {
4139
- **Type:** `() => JSX.Element`
4240
- **Required:** Yes
4341

44-
An accessor that returns the `children` value (typically `props.children`).
42+
Accessor that returns the component's `children` value.
4543

4644
## Return value
4745

48-
- **Type:** `ChildrenReturn`
46+
- **Type:** `Accessor<ResolvedChildren> & { toArray: () => ResolvedJSXElement[] }`
4947

50-
The function returns a callable accessor.
51-
Calling it yields the resolved children, either a single element or an array.
48+
Returns an accessor for the resolved children.
49+
The accessor also exposes `toArray()`.
5250

53-
## Helpers
51+
## Behavior
5452

55-
### `toArray()`
56-
57-
- **Type:** `() => ResolvedChildren[]`
58-
59-
- **Description:** Returns a flattened array of resolved child elements.
60-
61-
This method is exposed on the returned accessor and is useful for iteration or index-based logic.
53+
- The returned accessor memoizes the resolved children, so repeated reads use the resolved result instead of recreating the child structure.
54+
- `children` resolves nested arrays, fragments, and zero-argument child accessors from `props.children`.
55+
- `toArray()` returns the resolved children as an array. It returns `[]` when the resolved value is `null` or `undefined`.
6256

6357
## Examples
6458

@@ -71,50 +65,41 @@ function Wrapper(props) {
7165
return <div>{resolved()}</div>;
7266
}
7367

74-
// Usage
75-
<Wrapper>
76-
<span>one</span>
77-
<span>two</span>
78-
</Wrapper>;
68+
function Example() {
69+
return (
70+
<Wrapper>
71+
<span>First</span>
72+
<span>Second</span>
73+
</Wrapper>
74+
);
75+
}
7976
```
8077

81-
### `.toArray()` example
78+
### Flatten children into an array
8279

8380
```tsx
8481
function List(props) {
8582
const resolved = children(() => props.children);
86-
const items = resolved.toArray();
8783

8884
return (
8985
<ul>
90-
{items.map((child) => (
86+
{resolved.toArray().map((child) => (
9187
<li>{child}</li>
9288
))}
9389
</ul>
9490
);
9591
}
9692

97-
// Usage
98-
<List>
99-
<span>one</span>
100-
<span>two</span>
101-
</List>;
93+
function Example() {
94+
return (
95+
<List>
96+
<span>Alpha</span>
97+
<span>Beta</span>
98+
</List>
99+
);
100+
}
102101
```
103102

104-
> [!NOTE]
105-
> `children` resolves the current value of `props.children`.
106-
> If `props.children` is reactive, the resolved accessor reflects updates.
103+
## Related
107104

108-
### Working with function-as-children
109-
110-
If `children` is a function, the helper evaluates it and returns its rendered result.
111-
112-
```tsx
113-
function Slot(props) {
114-
const resolved = children(() => props.children);
115-
return <div>{resolved()}</div>;
116-
}
117-
118-
// Usage
119-
<Slot>{() => <span>dynamic</span>}</Slot>;
120-
```
105+
- [Props](/concepts/components/props)

0 commit comments

Comments
 (0)