Skip to content

Commit 94a40f6

Browse files
committed
Fixed minor issues only since last RFC update
1 parent 57120cd commit 94a40f6

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

src/routes/configuration/typescript.mdx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ In an environment without TypeScript, using the `ref` attribute in Solid ensures
451451
```js
452452
let divRef;
453453
console.log(divRef); // Outputs: undefined
454-
onMount(() => {
454+
onSettled(() => {
455455
console.log(divRef); // Outputs: <div> element
456456
});
457457
return <div ref={divRef} />;
@@ -465,17 +465,17 @@ A safe approach in TypeScript is to acknowledge that `divRef` may initially be `
465465
let divRef: HTMLDivElement | undefined
466466
// This would be flagged as an error during compilation
467467
divRef.focus()
468-
onMount(() => {
468+
onSettled(() => {
469469
if (!divRef) return
470470
divRef.focus()
471471
})
472472
return <div ref={divRef}>...</div>
473473
```
474474

475-
Within the scope of the `onMount` function, which runs after rendering, you can use a non-`null` assertion (indicated by the exclamation mark `!`):
475+
Within the scope of the `onSettled` function, which runs after rendering, you can use a non-`null` assertion (indicated by the exclamation mark `!`):
476476

477477
```typescript
478-
onMount(() => {
478+
onSettled(() => {
479479
divRef!.focus();
480480
});
481481
```
@@ -486,7 +486,7 @@ Another approach is to bypass `null` during the assignment phase and then apply
486486
let divRef: HTMLDivElement
487487
// Compilation error as expected
488488
divRef.focus()
489-
onMount(() => {
489+
onSettled(() => {
490490
divRef.focus()
491491
})
492492
return <div ref={divRef!}>...</div>
@@ -499,9 +499,7 @@ While TypeScript does catch incorrect usage of refs that occur before their
499499
JSX block definition, it currently does not identify undefined variables
500500
within certain nested functions in Solid. Therefore, additional care is needed
501501
when using `ref`s in functions such as
502-
[`createMemo`](/reference/basic-reactivity/create-memo),
503-
[`createRenderEffect`](/reference/secondary-primitives/create-render-effect),
504-
and [`createComputed`](/reference/secondary-primitives/create-computed).
502+
[`createMemo`](/reference/basic-reactivity/create-memo).
505503
:::
506504

507505
Finally, a riskier approach involves using the definite assignment assertion right at the point of variable initialization.
@@ -513,7 +511,7 @@ let divRef!: HTMLDivElement;
513511
// Permitted by TypeScript but will throw an error at runtime:
514512
// divRef.focus();
515513

516-
onMount(() => {
514+
onSettled(() => {
517515
divRef.focus();
518516
});
519517
```
@@ -737,6 +735,10 @@ declare module "solid-js" {
737735

738736
#### Custom directives
739737

738+
:::caution[Solid 2.0 — `use:` directives are removed]
739+
In Solid 2.0, `use:` directives are removed. Directives are now expressed as `ref` callbacks/factories. See [Refs](/concepts/refs#directives-via-ref-factories) for the 2.0 pattern. The TypeScript patterns below apply to Solid 1.x and the `@solidjs/legacy` compatibility layer.
740+
:::
741+
740742
In Solid, custom directives can be applied using the `use:___` attribute, which usually accepts a target element and a JSX attribute value.
741743
The traditional `Directives` interface types these values directly (i.e. the type of `value` in `<div use:foo={value} />`).
742744
However, the newer `DirectiveFunctions` interface takes a function type and derives the valid types for elements and values from it.

src/routes/reference/rendering/render-to-stream.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function renderToStream<T>(
3434
```
3535

3636
This method renders to a stream.
37-
It renders the content synchronously including any Suspense fallback placeholders, and then continues to stream the data and HTML from any async resource as it completes.
37+
It renders the content synchronously including any Loading fallback placeholders, and then continues to stream the data and HTML from any async resource as it completes.
3838

3939
```ts
4040
// node
@@ -46,7 +46,7 @@ renderToStream(App).pipeTo(writable)
4646
```
4747

4848
`onCompleteShell` fires when synchronous rendering is complete before writing the first flush to the stream out to the browser.
49-
`onCompleteAll` is called when all server Suspense boundaries have settled.
49+
`onCompleteAll` is called when all server Loading boundaries have settled.
5050
`renderId` is used to namespace renders when having multiple top level roots.
5151

5252
:::note
@@ -61,4 +61,4 @@ renderToStream(App).pipeTo(writable)
6161
| nonce | string | The nonce to use for inline scripts. |
6262
| renderId | string | The id to use for this render. |
6363
| onCompleteShell | () => void | A callback that fires when the shell is complete. |
64-
| onCompleteAll | () => void | A callback that fires when all Suspense boundaries have settled. |
64+
| onCompleteAll | () => void | A callback that fires when all Loading boundaries have settled. |

src/routes/reference/rendering/render-to-string-async.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function renderToStringAsync<T>(
2929

3030
```
3131

32-
Same as `renderToString` except that it will wait for all `<Suspense>` boundaries to resolve before returning the results.
32+
Same as `renderToString` except that it will wait for all `<Loading>` boundaries to resolve before returning the results.
3333
Resource data is automatically serialized into the script tag and will be hydrated on client load.
3434

3535
`renderId` is used to namespace renders when having multiple top level roots.
@@ -42,6 +42,6 @@ const html = await renderToStringAsync(App)
4242

4343
| Name | Type | Description |
4444
| ----------- | -------- | -------------------------------------------------------------------------------------------- |
45-
| `timeoutMs` | `number` | The number of milliseconds to wait for a `<Suspense>` boundary to resolve before timing out. |
45+
| `timeoutMs` | `number` | The number of milliseconds to wait for a `<Loading>` boundary to resolve before timing out. |
4646
| `renderId` | `string` | The id to use for the render. |
4747
| `nonce` | `string` | The nonce to use for the script tag. |

0 commit comments

Comments
 (0)