tempo-sdk 0.0.42 → 0.0.44
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.
- package/dist/canvas/index.js +24 -4
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/svelte.js +1 -1
- package/dist/{chunk-L7OESAOE.js → chunk-KQHC77IF.js} +9 -3
- package/dist/chunk-KQHC77IF.js.map +1 -0
- package/dist/{chunk-5V3XLGJU.js → chunk-MUW75SOS.js} +3 -3
- package/dist/{chunk-5V3XLGJU.js.map → chunk-MUW75SOS.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +2 -2
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-L7OESAOE.js.map +0 -1
package/dist/canvas/index.js
CHANGED
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
getStoryboardPortalSelectors,
|
|
13
13
|
normalizeId,
|
|
14
14
|
useActiveState,
|
|
15
|
+
useRenderErrorRecovery,
|
|
15
16
|
useRequiredCanvasHost
|
|
16
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-KQHC77IF.js";
|
|
17
18
|
import {
|
|
18
19
|
installTempoInteractProjectionSource
|
|
19
20
|
} from "../chunk-U52RN7MP.js";
|
|
@@ -104,15 +105,26 @@ function CanvasImportBoundary({
|
|
|
104
105
|
reportCanvasImportError
|
|
105
106
|
} = useRequiredCanvasHost();
|
|
106
107
|
const failedRef = useRef(false);
|
|
108
|
+
const importRejectedRef = useRef(false);
|
|
107
109
|
const loadRef = useRef(load);
|
|
108
110
|
const previousLoadRef = useRef(load);
|
|
109
111
|
loadRef.current = load;
|
|
110
112
|
const [retryRevision, setRetryRevision] = useState(0);
|
|
113
|
+
const retryRenderNow = useCallback(() => {
|
|
114
|
+
if (!failedRef.current || importRejectedRef.current) return false;
|
|
115
|
+
setRetryRevision((revision) => revision + 1);
|
|
116
|
+
return true;
|
|
117
|
+
}, []);
|
|
118
|
+
const { noteRenderError, noteRecovered } = useRenderErrorRecovery(retryRenderNow);
|
|
111
119
|
const lazyIdentity = `${canvasPath}:${retryRevision}`;
|
|
112
120
|
const LazyCanvas = useMemo(() => {
|
|
113
121
|
void lazyIdentity;
|
|
114
122
|
return lazy(
|
|
115
|
-
() => Promise.resolve().then(() =>
|
|
123
|
+
() => Promise.resolve().then(() => {
|
|
124
|
+
importRejectedRef.current = false;
|
|
125
|
+
return loadRef.current();
|
|
126
|
+
}).catch((error) => {
|
|
127
|
+
importRejectedRef.current = true;
|
|
116
128
|
getCanvasHostRecoveryFeed().publish({
|
|
117
129
|
type: "module-load-failure",
|
|
118
130
|
path: canvasPath,
|
|
@@ -125,14 +137,17 @@ function CanvasImportBoundary({
|
|
|
125
137
|
const reportError = useCallback(
|
|
126
138
|
(error) => {
|
|
127
139
|
failedRef.current = true;
|
|
140
|
+
if (importRejectedRef.current) noteRecovered();
|
|
141
|
+
else noteRenderError();
|
|
128
142
|
reportCanvasImportError(canvasPath, error);
|
|
129
143
|
},
|
|
130
|
-
[canvasPath, reportCanvasImportError]
|
|
144
|
+
[canvasPath, noteRecovered, noteRenderError, reportCanvasImportError]
|
|
131
145
|
);
|
|
132
146
|
const markCommitted = useCallback(() => {
|
|
133
147
|
failedRef.current = false;
|
|
148
|
+
noteRecovered();
|
|
134
149
|
clearCanvasImportError(canvasPath);
|
|
135
|
-
}, [canvasPath, clearCanvasImportError]);
|
|
150
|
+
}, [canvasPath, clearCanvasImportError, noteRecovered]);
|
|
136
151
|
useEffect(() => {
|
|
137
152
|
const loadChanged = previousLoadRef.current !== load;
|
|
138
153
|
previousLoadRef.current = load;
|
|
@@ -2343,6 +2358,11 @@ function CanvasHost({
|
|
|
2343
2358
|
const normalizedId = normalizeId(storyboardId, "Storyboard id");
|
|
2344
2359
|
return directUrlRender?.renderId === normalizedId ? { left: 0, top: 0 } : void 0;
|
|
2345
2360
|
},
|
|
2361
|
+
prepareStoryboardCapture(storyboardId) {
|
|
2362
|
+
if (directUrlRender?.renderId !== storyboardId) return;
|
|
2363
|
+
const captureGlobal = globalThis;
|
|
2364
|
+
captureGlobal.__tempoResetCaptureDeterminism?.();
|
|
2365
|
+
},
|
|
2346
2366
|
markStoryboardRendered,
|
|
2347
2367
|
markStoryboardUnmounted,
|
|
2348
2368
|
reportStoryboardError,
|