Skip to content

Commit 8402421

Browse files
docs: demote boundary primitives in solid-js
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 17a858b commit 8402421

4 files changed

Lines changed: 32 additions & 43 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"solid-js": patch
3+
---
4+
5+
Demote low-level `solid-js` boundary primitive docs in favor of the component APIs.

packages/solid/src/client/hydration.ts

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
isDisposed,
99
getNextChildId,
1010
peekNextChildId,
11+
createRevealOrder as coreRevealOrder,
1112
createMemo as coreMemo,
1213
createSignal as coreSignal,
1314
createOptimistic as coreOptimistic,
@@ -32,6 +33,7 @@ import {
3233
type SourceAccessor,
3334
type Store,
3435
type StoreSetter,
36+
type RevealOrder,
3537
createOwner,
3638
getContext,
3739
setContext,
@@ -898,42 +900,40 @@ export const createSignal: {
898900
} = ((...args: any[]) => (_createSignal || coreSignal)(...args)) as any;
899901

900902
/**
901-
* Lower-level primitive that backs the `<Errored>` flow control.
903+
* Internal primitive that backs the `<Errored>` flow control.
902904
* Catches errors thrown inside `fn` and renders `fallback(error,
903905
* reset)` instead. `error` is an accessor for the latest captured error;
904906
* `reset()` recomputes the failing sources so the boundary can attempt to recover.
905907
*
906-
* App code should use `<Errored fallback={...}>` directly — reach for
907-
* this only when authoring a custom boundary component.
908+
* App code should use `<Errored fallback={...}>` directly. This primitive is
909+
* kept exported for renderer, test, and compatibility use, but it is not part
910+
* of the recommended application authoring surface.
908911
*
909912
* **Hydration:** if the server serialized an error for this boundary,
910913
* the client re-throws it on the first hydration pass so `fallback`
911914
* renders the same content the server emitted.
912915
*
913-
* @example
914-
* ```tsx
915-
* // Custom boundary built on the primitive — adds telemetry around the
916-
* // canonical `<Errored>` shape.
917-
* function TracedErrored(props: {
918-
* fallback: (e: () => unknown) => JSX.Element;
919-
* children: JSX.Element;
920-
* }): JSX.Element {
921-
* return createErrorBoundary(
922-
* () => props.children,
923-
* (err, reset) => {
924-
* reportError(err());
925-
* return props.fallback(err);
926-
* }
927-
* ) as unknown as JSX.Element;
928-
* }
929-
* ```
916+
* @internal
930917
*/
931918
export const createErrorBoundary = ((...args: any[]) =>
932919
(_createErrorBoundary || coreErrorBoundary)(...args)) as <U>(
933920
fn: () => any,
934921
fallback: (error: Accessor<unknown>, reset: () => void) => U
935922
) => () => unknown;
936923

924+
/**
925+
* Internal primitive that backs `<Reveal>` coordination of sibling loading
926+
* boundaries. App code should use `<Reveal>` directly.
927+
*
928+
* @internal
929+
*/
930+
export function createRevealOrder<T>(
931+
fn: () => T,
932+
options?: { order?: () => RevealOrder; collapsed?: () => boolean }
933+
): T {
934+
return coreRevealOrder(fn, options);
935+
}
936+
937937
/**
938938
* Creates an optimistic signal — a `Signal<T>` whose writes are
939939
* tentative inside an `action` transition: they show up immediately,
@@ -1308,22 +1308,14 @@ function scheduleResumeAfterAssets(
13081308
}
13091309

13101310
/**
1311-
* Lower-level primitive that backs the `<Loading>` component. Returns a
1311+
* Internal primitive that backs the `<Loading>` component. Returns a
13121312
* computation that yields `fallback()` while async reads inside `fn` are
1313-
* pending, and `fn()` once they have settled. Most callers should use
1314-
* `<Loading>` directly; this is exposed for renderers and library authors.
1313+
* pending, and `fn()` once they have settled. App code should use `<Loading>`
1314+
* directly. This primitive is kept exported for renderer, test, and
1315+
* compatibility use, but it is not part of the recommended application
1316+
* authoring surface.
13151317
*
1316-
* @example
1317-
* ```tsx
1318-
* // Custom boundary component built on the primitive. App code uses
1319-
* // `<Loading fallback={…}>` directly.
1320-
* function MyLoading(props: { fallback: JSX.Element; children: JSX.Element }): JSX.Element {
1321-
* return createLoadingBoundary(
1322-
* () => props.children,
1323-
* () => props.fallback
1324-
* ) as unknown as JSX.Element;
1325-
* }
1326-
* ```
1318+
* @internal
13271319
*/
13281320
export function createLoadingBoundary(
13291321
fn: () => any,

packages/solid/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export {
55
action,
66
createOwner,
77
createReaction,
8-
createRevealOrder,
98
createRoot,
109
createTrackedEffect,
1110
deep,
@@ -92,6 +91,7 @@ export {
9291
enableHydration,
9392
createErrorBoundary,
9493
createLoadingBoundary,
94+
createRevealOrder,
9595
createMemo,
9696
createSignal,
9797
createStore,

packages/solid/src/server/hydration.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ export function ssrHandleError(err: any) {
6565
throw err;
6666
}
6767

68-
/**
69-
* Tracks all resources inside a component and renders a fallback until they are all resolved
70-
*
71-
* On the server, this is SSR-aware: it handles async mode (streaming) by registering
72-
* fragments and resolving asynchronously, and sync mode by serializing fallback markers.
73-
*
74-
* @description https://docs.solidjs.com/reference/components/suspense
75-
*/
7668
export function createLoadingBoundary(
7769
fn: () => any,
7870
fallback: () => any,

0 commit comments

Comments
 (0)