Skip to content

Commit 7ac0e03

Browse files
fix: restore documentation validation
Format regenerated API pages consistently and make persisted tab state explicit so current Solid signal types pass CI. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4c94719 commit 7ac0e03

80 files changed

Lines changed: 989 additions & 841 deletions

File tree

Some content is hidden

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

osmium/src/mdx-components.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
type JSX,
44
Match,
55
type ParentProps,
6+
type Signal,
67
Switch,
78
children,
89
createMemo,
@@ -90,13 +91,16 @@ const TabGroup = (props: {
9091

9192
// Groups sharing a sync key select together across the page and tabs,
9293
// and the choice persists between visits.
93-
const [openTab, setOpenTab] = makePersisted(createSignal(props.tabNames[0]), {
94-
name: `tab-group:${props.syncKey}`,
95-
sync: messageSync(new BroadcastChannel("tab-group")),
96-
storage: cookieStorage.withOptions({
97-
expires: new Date(Date.now() + 3e10),
98-
}),
99-
});
94+
const [openTab, setOpenTab] = makePersisted<string, Signal<string>>(
95+
createSignal(props.tabNames[0]),
96+
{
97+
name: `tab-group:${props.syncKey}`,
98+
sync: messageSync(new BroadcastChannel("tab-group")),
99+
storage: cookieStorage.withOptions({
100+
expires: new Date(Date.now() + 3e10),
101+
}),
102+
}
103+
);
100104
return tabs(openTab, setOpenTab);
101105
};
102106

src/routes/reference/(1)solid-js/(1)reactivity/create-effect.mdx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ source_path: "packages/signals/src/signals.ts"
2020

2121
Creates a reactive effect with **separate compute and effect phases**.
2222

23-
- `compute(prev)` runs reactively — *put all reactive reads here*. The
23+
- `compute(prev)` runs reactively — _put all reactive reads here_. The
2424
returned value is passed to `effect` and is also the new "previous" value
2525
for the next run.
2626
- `effect(next, prev?)` runs imperatively (untracked) after the queue
27-
flushes. *Put DOM writes / fetch / logging / subscriptions here.* It may
27+
flushes. _Put DOM writes / fetch / logging / subscriptions here._ It may
2828
return a cleanup function which runs before the next effect or on
2929
disposal.
3030

31-
Reactive reads inside `effect` will *not* re-trigger this effect — that's
31+
Reactive reads inside `effect` will _not_ re-trigger this effect — that's
3232
intentional. If you need a single-phase tracked effect, use
3333
`createTrackedEffect` (with the tradeoffs noted there).
3434

@@ -38,7 +38,7 @@ from upstream reactive sources (including async rejections), which your own
3838
code has no frame to `try/catch`. The `error` handler is the error arm of
3939
the effect phase: it runs on the same schedule and in the same imperative,
4040
writable scope as `effect` (setting error state via signals is fine), and
41-
only for *settled* errors — a transient error that recovers before the
41+
only for _settled_ errors — a transient error that recovers before the
4242
effect phase runs `effect` with the recovered value instead, and a held update defers it exactly as it defers `effect`. Without an `error`
4343
handler a compute-phase error is logged and the effect simply skips that
4444
run — a non-render effect's reactivity failing does not crash the app.
@@ -49,18 +49,18 @@ The **effect phase is different**: it is your own imperative code, so handle
4949
failures with `try/catch` where they occur. An uncaught effect-phase throw
5050
is treated as an unhandled application error — caught by the nearest
5151
`createErrorBoundary`/`<Errored>`, and permanently halting the reactive
52-
system if there is none. It is *not* routed to the bundle's `error` handler.
52+
system if there is none. It is _not_ routed to the bundle's `error` handler.
5353

5454
```typescript
5555
createEffect<T>(compute, effectFn | { effect, error }, options?: EffectOptions);
5656
```
5757

5858
> Deprecated: `createEffect(compute)` (single argument) is no longer supported.
59-
Pass a separate effect function as the second argument:
60-
`createEffect(compute, effect)`. See `MISSING_EFFECT_FN`.
59+
> Pass a separate effect function as the second argument:
60+
> `createEffect(compute, effect)`. See `MISSING_EFFECT_FN`.
6161
6262
- For a side effect that reacts to changes, split the work:
63-
`createEffect(() => signal(), value => doWork(value))`.
63+
`createEffect(() => signal(), value => doWork(value))`.
6464
- For a derived value, use `createMemo(() => signal())`.
6565
- For a one-shot side effect at construction time, just call the function.
6666

@@ -74,11 +74,13 @@ import { createEffect } from "solid-js";
7474

7575
```ts
7676
function createEffect<T>(
77-
compute: ComputeFunction<undefined | NoInfer<T>, T>,
78-
effectFn: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>,
79-
options?: EffectOptions
77+
compute: ComputeFunction<undefined | NoInfer<T>, T>,
78+
effectFn: EffectFunction<NoInfer<T>, T> | EffectBundle<NoInfer<T>, T>,
79+
options?: EffectOptions
8080
): void;
81-
function createEffect<T>(compute: ComputeFunction<undefined | NoInfer<T>, T>): never;
81+
function createEffect<T>(
82+
compute: ComputeFunction<undefined | NoInfer<T>, T>
83+
): never;
8284
```
8385

8486
## Parameters
@@ -101,21 +103,21 @@ A function that receives the new value and is used to perform side effects (retu
101103
const [count, setCount] = createSignal(0);
102104

103105
createEffect(
104-
() => count(), // compute: tracks `count`
105-
value => console.log(value) // effect: side effect
106+
() => count(), // compute: tracks `count`
107+
(value) => console.log(value) // effect: side effect
106108
);
107109

108110
setCount(1); // logs 1 after the next flush
109111
```
110112

111113
```ts
112114
createEffect(
113-
() => userId(),
114-
id => {
115-
const ctrl = new AbortController();
116-
fetch(`/users/${id}`, { signal: ctrl.signal });
117-
return () => ctrl.abort(); // cleanup before next run / disposal
118-
}
115+
() => userId(),
116+
(id) => {
117+
const ctrl = new AbortController();
118+
fetch(`/users/${id}`, { signal: ctrl.signal });
119+
return () => ctrl.abort(); // cleanup before next run / disposal
120+
}
119121
);
120122
```
121123

@@ -125,16 +127,16 @@ createEffect(
125127

126128
```ts
127129
type ComputeFunction<Prev, Next extends Prev = Prev> = (
128-
v: Prev
130+
v: Prev
129131
) => PromiseLike<Next> | AsyncIterable<Next> | Next;
130132
```
131133

132134
### `EffectBundle`
133135

134136
```ts
135137
type EffectBundle<Prev, Next extends Prev = Prev> = {
136-
effect: EffectFunction<Prev, Next>;
137-
error: (err: unknown, cleanup: () => void) => void;
138+
effect: EffectFunction<Prev, Next>;
139+
error: (err: unknown, cleanup: () => void) => void;
138140
};
139141
```
140142

@@ -160,8 +162,8 @@ outcomes — an error that recovers before the effect phase runs the
160162

161163
```ts
162164
type EffectFunction<Prev, Next extends Prev = Prev> = (
163-
v: Next,
164-
p?: Prev
165+
v: Next,
166+
p?: Prev
165167
) => (() => void) | void;
166168
```
167169

@@ -171,11 +173,11 @@ Options for effect primitives that support deferring/scheduling their initial ru
171173

172174
```ts
173175
interface EffectOptions extends BaseEffectOptions {
174-
defer?: boolean;
175-
schedule?: boolean;
176-
sync?: boolean;
177-
transparent?: boolean;
178-
};
176+
defer?: boolean;
177+
schedule?: boolean;
178+
sync?: boolean;
179+
transparent?: boolean;
180+
}
179181
```
180182

181183
#### `defer`

src/routes/reference/(1)solid-js/(1)reactivity/create-memo.mdx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ import { createMemo } from "solid-js";
3434

3535
```ts
3636
function createMemo<T>(
37-
compute: ComputeFunction<NoInfer<T>, T>,
38-
options: MemoOptions<T> & { loadingValue: T }
37+
compute: ComputeFunction<NoInfer<T>, T>,
38+
options: MemoOptions<T> & { loadingValue: T }
3939
): SourceAccessor<T>;
4040
function createMemo<T>(
41-
compute: ComputeFunction<undefined | NoInfer<T>, T>,
42-
options?: MemoOptions<T>
41+
compute: ComputeFunction<undefined | NoInfer<T>, T>,
42+
options?: MemoOptions<T>
4343
): SourceAccessor<T>;
4444
```
4545

@@ -67,8 +67,8 @@ fullName(); // "Ada Lovelace"
6767
```ts
6868
// Async memo — reads surface as pending inside <Loading>
6969
const user = createMemo(async () => {
70-
const res = await fetch(`/users/${id()}`);
71-
return res.json();
70+
const res = await fetch(`/users/${id()}`);
71+
return res.json();
7272
});
7373
```
7474

@@ -88,15 +88,15 @@ Also used in combination with `SignalOptions` for writable memos
8888

8989
```ts
9090
interface MemoOptions<T> {
91-
id?: string;
92-
name?: string;
93-
transparent?: boolean;
94-
equals?: false | ((prev: T, next: T) => boolean);
95-
unobserved?: () => void;
96-
lazy?: boolean;
97-
sync?: boolean;
98-
loadingValue?: T;
99-
};
91+
id?: string;
92+
name?: string;
93+
transparent?: boolean;
94+
equals?: false | ((prev: T, next: T) => boolean);
95+
unobserved?: () => void;
96+
lazy?: boolean;
97+
sync?: boolean;
98+
loadingValue?: T;
99+
}
100100
```
101101

102102
#### `id`
@@ -192,11 +192,11 @@ Options for plain signals created with `createSignal(value)` or `createOptimisti
192192

193193
```ts
194194
interface SignalOptions<T> {
195-
name?: string;
196-
equals?: false | ((prev: T, next: T) => boolean);
197-
ownedWrite?: boolean;
198-
unobserved?: () => void;
199-
};
195+
name?: string;
196+
equals?: false | ((prev: T, next: T) => boolean);
197+
ownedWrite?: boolean;
198+
unobserved?: () => void;
199+
}
200200
```
201201

202202
#### `name`

src/routes/reference/(1)solid-js/(1)reactivity/create-optimistic.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ import { createOptimistic } from "solid-js";
4242
```ts
4343
function createOptimistic<T>(): Signal<T | undefined>;
4444
function createOptimistic<T>(
45-
value: Exclude<T, Function>,
46-
options?: SignalOptions<T>
45+
value: Exclude<T, Function>,
46+
options?: SignalOptions<T>
4747
): Signal<T>;
4848
function createOptimistic<T>(
49-
fn: ComputeFunction<T>,
50-
options?: SignalOptions<T> & MemoOptions<T>
49+
fn: ComputeFunction<T>,
50+
options?: SignalOptions<T> & MemoOptions<T>
5151
): Signal<T>;
5252
```
5353

@@ -71,9 +71,9 @@ Optional object with a name for debugging purposes and equals, a comparator func
7171
const [todos, setTodos] = createOptimistic(initialTodos);
7272

7373
const addTodo = action(function* (text: string) {
74-
const tempId = crypto.randomUUID();
75-
setTodos(t => [...t, { id: tempId, text, pending: true }]); // optimistic
76-
const saved = yield api.createTodo(text);
77-
setTodos(t => t.map(x => (x.id === tempId ? saved : x))); // reconcile
74+
const tempId = crypto.randomUUID();
75+
setTodos((t) => [...t, { id: tempId, text, pending: true }]); // optimistic
76+
const saved = yield api.createTodo(text);
77+
setTodos((t) => t.map((x) => (x.id === tempId ? saved : x))); // reconcile
7878
});
7979
```

src/routes/reference/(1)solid-js/(1)reactivity/create-signal.mdx

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ import { createSignal } from "solid-js";
4040

4141
```ts
4242
function createSignal<T>(): Signal<T | undefined>;
43-
function createSignal<T>(value: Exclude<T, Function>, options?: SignalOptions<T>): Signal<T>;
4443
function createSignal<T>(
45-
fn: ComputeFunction<T>,
46-
options?: SignalOptions<T> & MemoOptions<T>
44+
value: Exclude<T, Function>,
45+
options?: SignalOptions<T>
46+
): Signal<T>;
47+
function createSignal<T>(
48+
fn: ComputeFunction<T>,
49+
options?: SignalOptions<T> & MemoOptions<T>
4750
): Signal<T>;
4851
```
4952

@@ -66,9 +69,9 @@ Optional object with a name for debugging purposes and equals, a comparator func
6669
```ts
6770
const [count, setCount] = createSignal(0);
6871

69-
count(); // 0
70-
setCount(1); // explicit value
71-
setCount(c => c + 1); // updater
72+
count(); // 0
73+
setCount(1); // explicit value
74+
setCount((c) => c + 1); // updater
7275
```
7376

7477
```ts
@@ -94,15 +97,15 @@ Also used in combination with `SignalOptions` for writable memos
9497

9598
```ts
9699
interface MemoOptions<T> {
97-
id?: string;
98-
name?: string;
99-
transparent?: boolean;
100-
equals?: false | ((prev: T, next: T) => boolean);
101-
unobserved?: () => void;
102-
lazy?: boolean;
103-
sync?: boolean;
104-
loadingValue?: T;
105-
};
100+
id?: string;
101+
name?: string;
102+
transparent?: boolean;
103+
equals?: false | ((prev: T, next: T) => boolean);
104+
unobserved?: () => void;
105+
lazy?: boolean;
106+
sync?: boolean;
107+
loadingValue?: T;
108+
}
106109
```
107110

108111
#### `id`
@@ -204,11 +207,11 @@ Options for plain signals created with `createSignal(value)` or `createOptimisti
204207

205208
```ts
206209
interface SignalOptions<T> {
207-
name?: string;
208-
equals?: false | ((prev: T, next: T) => boolean);
209-
ownedWrite?: boolean;
210-
unobserved?: () => void;
211-
};
210+
name?: string;
211+
equals?: false | ((prev: T, next: T) => boolean);
212+
ownedWrite?: boolean;
213+
unobserved?: () => void;
214+
}
212215
```
213216

214217
#### `name`

src/routes/reference/(1)solid-js/(1)reactivity/flush.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ flush scope before draining the queue.
2222

2323
Reactive updates are normally batched onto the microtask queue, so multiple
2424
writes in a row collapse into a single update pass. Call `flush()` when you
25-
need to *observe* the result of those writes synchronously — most commonly
25+
need to _observe_ the result of those writes synchronously — most commonly
2626
in tests, but also at the boundary of imperative integration code. Pass a
2727
callback when the writes themselves should bypass microtask scheduling and
2828
drain synchronously when the callback returns.
@@ -55,8 +55,8 @@ expect(doubled()).toBe(12);
5555

5656
// Nested flushes drain at each level:
5757
flush(() => {
58-
setCount(7);
59-
flush(() => setCount(8)); // inner drain — effects fire here
60-
// outer continues with up-to-date state
58+
setCount(7);
59+
flush(() => setCount(8)); // inner drain — effects fire here
60+
// outer continues with up-to-date state
6161
});
6262
```

src/routes/reference/(1)solid-js/(1)reactivity/untrack.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function untrack<T>(fn: () => T, strictReadLabel?: string | false): T;
4343

4444
```ts
4545
createEffect(
46-
() => trigger(), // tracks `trigger` only
47-
() => {
48-
const snapshot = untrack(() => state); // read once, untracked
49-
log(snapshot);
50-
}
46+
() => trigger(), // tracks `trigger` only
47+
() => {
48+
const snapshot = untrack(() => state); // read once, untracked
49+
log(snapshot);
50+
}
5151
);
5252
```

0 commit comments

Comments
 (0)