feat(editor): a clear final state once the engine spent its three recoveries (canvas and action alerts)
This commit is contained in:
1 parent
f0580922b5
commit
0279953e9e
19 files changed
+101
-16
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { coreStopped } from '@/core/runtime'
|
||||
import type { SheetIndex } from '@/services/sheetIndex'
|
||||
|
||||
/**
|
||||
@@ -10,11 +11,12 @@ import type { SheetIndex } from '@/services/sheetIndex'
|
||||
export type ViewStates = ReadonlyMap<string, 'current'>
|
||||
|
||||
/**
|
||||
* Why a view cannot be drawn: the engine did not run (a retry may succeed), or the view
|
||||
* Why a view cannot be drawn: the engine did not run (a retry may succeed), the engine
|
||||
* stopped after its three recoveries (only a reload starts it again), or the view
|
||||
* itself cannot be drawn (a refused drawing, a view the core cannot compose: retrying
|
||||
* changes nothing). The technical kind stays in the core's outcome and the DEV console.
|
||||
*/
|
||||
export type ViewFailure = 'engine' | 'view'
|
||||
export type ViewFailure = 'engine' | 'engine_stopped' | 'view'
|
||||
|
||||
export type ViewBuild = { ok: true; svg: SVGSVGElement } | { ok: false; failure: ViewFailure }
|
||||
|
||||
@@ -28,7 +30,8 @@ function failed(failure: ViewFailure, kind: string, detail?: string): ViewBuild
|
||||
export function buildViewSvg(index: SheetIndex, viewId: string): ViewBuild {
|
||||
const text = index.canvasSvg(viewId)
|
||||
if (!text.ok) {
|
||||
return failed(ENGINE_KINDS.has(text.kind) ? 'engine' : 'view', text.kind, text.detail)
|
||||
const engine = coreStopped() ? 'engine_stopped' : 'engine'
|
||||
return failed(ENGINE_KINDS.has(text.kind) ? engine : 'view', text.kind, text.detail)
|
||||
}
|
||||
const parsed = new DOMParser().parseFromString(text.value, 'image/svg+xml')
|
||||
const root = parsed.documentElement
|
||||
|
||||
Reference in new issue
Block a user