@dfosco/storyboard-react 4.0.0-beta.31 → 4.0.0-beta.32
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/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfosco/storyboard-react",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dfosco/storyboard-core": "4.0.0-beta.
|
|
7
|
-
"@dfosco/tiny-canvas": "4.0.0-beta.
|
|
6
|
+
"@dfosco/storyboard-core": "4.0.0-beta.32",
|
|
7
|
+
"@dfosco/tiny-canvas": "4.0.0-beta.32",
|
|
8
8
|
"@neodrag/react": "^2.3.1",
|
|
9
9
|
"glob": "^11.0.0",
|
|
10
10
|
"jsonc-parser": "^3.3.1",
|
|
@@ -304,13 +304,19 @@ export default forwardRef(function PrototypeEmbed({ id: widgetId, props, onUpdat
|
|
|
304
304
|
|
|
305
305
|
// On canvas theme change, enqueue a background snapshot refresh.
|
|
306
306
|
// Skips the initial render (canvasThemeInitRef tracks first value).
|
|
307
|
+
// Uses a ref to check hasSnap at callback time (not closure time).
|
|
307
308
|
const canvasThemeInitRef = useRef(true)
|
|
308
309
|
const refreshMetaRef = useRef(null)
|
|
310
|
+
const hasSnapRef = useRef(hasSnap)
|
|
311
|
+
hasSnapRef.current = hasSnap
|
|
309
312
|
useEffect(() => {
|
|
310
313
|
if (canvasThemeInitRef.current) { canvasThemeInitRef.current = false; return }
|
|
311
314
|
if (isExternal || !onUpdate || interactive || !hasSnap) return
|
|
312
315
|
const rect = embedRef.current?.getBoundingClientRect()
|
|
313
316
|
enqueueRefresh(widgetId, ({ revealOrder, batchStart }) => {
|
|
317
|
+
// Re-check hasSnap at callback time — snapshot may have been
|
|
318
|
+
// marked broken (404) between enqueue and execution.
|
|
319
|
+
if (!hasSnapRef.current) return Promise.resolve(false)
|
|
314
320
|
return new Promise((resolve) => {
|
|
315
321
|
refreshMetaRef.current = { revealOrder, batchStart, resolve }
|
|
316
322
|
captureOnReadyRef.current = true
|