@dfosco/storyboard-react 4.0.0-beta.19 → 4.0.0-beta.20
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.20",
|
|
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.20",
|
|
7
|
+
"@dfosco/tiny-canvas": "4.0.0-beta.20",
|
|
8
8
|
"@neodrag/react": "^2.3.1",
|
|
9
9
|
"glob": "^11.0.0",
|
|
10
10
|
"jsonc-parser": "^3.3.1",
|
|
@@ -235,22 +235,29 @@ export default forwardRef(function StoryWidget({ id: widgetId, props, onUpdate,
|
|
|
235
235
|
if (!showCode || sourceCode !== null) return
|
|
236
236
|
const story = getStoryData(storyId)
|
|
237
237
|
if (!story?._storyModule) {
|
|
238
|
-
|
|
238
|
+
setSourceCode('// Source not available')
|
|
239
239
|
return
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
let cancelled = false
|
|
243
|
-
|
|
243
|
+
setSourceLoading(true)
|
|
244
244
|
|
|
245
245
|
fetchStorySource(story._storyModule)
|
|
246
246
|
.then((code) => {
|
|
247
247
|
if (cancelled) return
|
|
248
248
|
setSourceCode(code || '// Empty file')
|
|
249
|
+
setSourceLoading(false)
|
|
250
|
+
})
|
|
251
|
+
.catch(() => {
|
|
252
|
+
if (cancelled) return
|
|
253
|
+
setSourceCode('// Failed to load source')
|
|
254
|
+
setSourceLoading(false)
|
|
249
255
|
})
|
|
250
|
-
.catch(() => { if (!cancelled) setSourceCode('// Failed to load source') })
|
|
251
|
-
.finally(() => { if (!cancelled) setSourceLoading(false) })
|
|
252
256
|
|
|
253
|
-
return () => {
|
|
257
|
+
return () => {
|
|
258
|
+
cancelled = true
|
|
259
|
+
setSourceLoading(false)
|
|
260
|
+
}
|
|
254
261
|
}, [showCode, sourceCode, storyId])
|
|
255
262
|
|
|
256
263
|
// Re-highlight when the code-box theme changes (storyboard:theme:changed event).
|