@hueest/xray 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -268,5 +268,27 @@ function renderChunks(chunks, resolveStitch) {
|
|
|
268
268
|
}, i);
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* A never-settling promise for the loading suspender below. It never needs to
|
|
273
|
+
* resolve: React retries a suspended boundary when its parent re-renders with new
|
|
274
|
+
* props (here, `loading` flipping to false), so the prop change — not the promise —
|
|
275
|
+
* drives recovery.
|
|
276
|
+
*/
|
|
277
|
+
const SUSPEND_UNTIL_READY = new Promise(() => {});
|
|
278
|
+
/**
|
|
279
|
+
* Suspends while `loading` is true. It exists so a `suspense`-mode `<Skeleton>` can
|
|
280
|
+
* show its plate through the ONE Suspense fallback across BOTH readiness phases — the
|
|
281
|
+
* data-loading phase (this suspender) AND the lazy code-chunk phase (the content
|
|
282
|
+
* itself suspending). Because the plate is the SAME fallback DOM node the whole time,
|
|
283
|
+
* there is no unmount/remount between the two phases and thus no flicker (a top-level
|
|
284
|
+
* `return skeleton` for the data phase followed by a Suspense-fallback skeleton for
|
|
285
|
+
* the chunk phase are different tree positions, so they DID remount). While this
|
|
286
|
+
* throws, the content sibling is never committed, preserving "children never render
|
|
287
|
+
* without data" (ADR 0002).
|
|
288
|
+
*/
|
|
289
|
+
function SuspendWhileLoading({ loading }) {
|
|
290
|
+
if (loading) throw SUSPEND_UNTIL_READY;
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
271
293
|
//#endregion
|
|
272
|
-
export {
|
|
294
|
+
export { markStitchesLive as a, useSkeletonTiming as c, isStitchLive as i, collectStitchNames as n, renderPlate as o, isRenderProp as r, resolveContent as s, SuspendWhileLoading as t };
|
package/dist/react.dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as BOUNDARY_ATTR } from "./plate-BRR6d8Se.js";
|
|
2
|
-
import { a as
|
|
2
|
+
import { a as markStitchesLive, c as useSkeletonTiming, i as isStitchLive, n as collectStitchNames, o as renderPlate, r as isRenderProp, s as resolveContent, t as SuspendWhileLoading } from "./react.core-BC02ukac.js";
|
|
3
3
|
import { Suspense, useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
|
-
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region src/react.dev.tsx
|
|
6
6
|
const noSubscribe = () => () => {};
|
|
7
7
|
const alwaysFalse = () => false;
|
|
@@ -117,9 +117,9 @@ function Skeleton(props) {
|
|
|
117
117
|
maxDepth,
|
|
118
118
|
children
|
|
119
119
|
});
|
|
120
|
-
if (suspense) return /* @__PURE__ */
|
|
120
|
+
if (suspense) return /* @__PURE__ */ jsxs(Suspense, {
|
|
121
121
|
fallback: skeleton,
|
|
122
|
-
children: content
|
|
122
|
+
children: [/* @__PURE__ */ jsx(SuspendWhileLoading, { loading: showSkeleton }), content]
|
|
123
123
|
});
|
|
124
124
|
if (showSkeleton) return skeleton;
|
|
125
125
|
return content;
|
package/dist/react.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as markStitchesLive, c as useSkeletonTiming, i as isStitchLive, n as collectStitchNames, o as renderPlate, s as resolveContent, t as SuspendWhileLoading } from "./react.core-BC02ukac.js";
|
|
2
2
|
import { Suspense, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
//#region src/react.tsx
|
|
5
5
|
/**
|
|
6
6
|
* React adapter for rendering committed Plates through `<Skeleton>`.
|
|
@@ -44,9 +44,9 @@ function Skeleton(props) {
|
|
|
44
44
|
rootRef,
|
|
45
45
|
instant
|
|
46
46
|
});
|
|
47
|
-
if (suspense) return /* @__PURE__ */
|
|
47
|
+
if (suspense) return /* @__PURE__ */ jsxs(Suspense, {
|
|
48
48
|
fallback: skeleton,
|
|
49
|
-
children: resolveContent(children, data)
|
|
49
|
+
children: [/* @__PURE__ */ jsx(SuspendWhileLoading, { loading: showSkeleton }), resolveContent(children, data)]
|
|
50
50
|
});
|
|
51
51
|
if (showSkeleton) return skeleton;
|
|
52
52
|
return /* @__PURE__ */ jsx(Fragment$1, { children: resolveContent(children, data) });
|