mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Image export: surface rasterize/serialize failures instead of reporting 'not ready'
This commit is contained in:
@@ -342,8 +342,11 @@ export function LivePreview() {
|
||||
]);
|
||||
|
||||
// Rasterize/serialize the live view for the per-chart export (spec §08). Reads
|
||||
// `handleRef` (the view LivePreview owns); returns null when no view is live or
|
||||
// the export fails, so the export UI can report it. Stable identity (no deps).
|
||||
// `handleRef` (the view LivePreview owns); returns null only when no view is live
|
||||
// (the "not ready" case). A rasterize/serialize *failure* is a real error, not a
|
||||
// not-ready state, so it propagates for the export UI to report with its detail —
|
||||
// burying it here would misreport a tainted canvas or a serialization bug as
|
||||
// "not ready yet" (arch 02 fail-loud). Stable identity (no deps).
|
||||
const getImageUrl = useCallback(
|
||||
async (
|
||||
format: 'png' | 'svg',
|
||||
@@ -351,11 +354,7 @@ export function LivePreview() {
|
||||
): Promise<string | null> => {
|
||||
const handle = handleRef.current;
|
||||
if (!handle) return null;
|
||||
try {
|
||||
return await handle.toImageURL(format, options);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
return await handle.toImageURL(format, options);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user