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.
@@ -12,8 +12,9 @@ import {
12
12
  getStoryboardPortalSelectors,
13
13
  normalizeId,
14
14
  useActiveState,
15
+ useRenderErrorRecovery,
15
16
  useRequiredCanvasHost
16
- } from "../chunk-L7OESAOE.js";
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(() => loadRef.current()).catch((error) => {
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,