mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-22 13:32:11 +00:00
- Uncomment canvasNotMeasurable guards in DragAndScale fitToBounds/animateToBounds - Make LGraphCanvas.resize() delegate to measureViewport/applyViewport - Move devAssert to src/base/common/ (DDD layer compliance) - Enhance devAssert with pluggable reporter hook; wire Sentry + toast in main.ts - Set ADR 0009 status to Proposed (pending full migration in follow-up)
22 lines
484 B
TypeScript
22 lines
484 B
TypeScript
type AssertReporter = (formatted: string) => void
|
|
|
|
let reporter: AssertReporter | undefined
|
|
|
|
function setDevAssertReporter(fn: AssertReporter) {
|
|
reporter = fn
|
|
}
|
|
|
|
function devAssert(condition: boolean, message: string): asserts condition {
|
|
if (!condition) {
|
|
const formatted = `[Invariant] ${message}`
|
|
console.error(formatted)
|
|
reporter?.(formatted)
|
|
|
|
if (import.meta.env.DEV) {
|
|
throw new Error(formatted)
|
|
}
|
|
}
|
|
}
|
|
|
|
export { devAssert, setDevAssertReporter }
|