From ff9194a8e878d1ce2a47e5e8998c040fcca4eef3 Mon Sep 17 00:00:00 2001 From: tianma-if Date: Sun, 27 Sep 2026 16:14:44 +0800 Subject: [PATCH] fix(web): keep @antv/infographic registry atomic to prevent render failure --- apps/web/src/components/InfographicEditorPane.tsx | 6 +++++- apps/web/vite.config.ts | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/InfographicEditorPane.tsx b/apps/web/src/components/InfographicEditorPane.tsx index 0e3db9ae..5b3e4d0c 100644 --- a/apps/web/src/components/InfographicEditorPane.tsx +++ b/apps/web/src/components/InfographicEditorPane.tsx @@ -329,10 +329,14 @@ export default function InfographicEditorPane({ setRenderError(null); setPreviewReady(true); } catch (caught) { + console.error("Failed to render infographic", caught); setRenderError(caught instanceof Error ? caught.message : t("infographic.renderError")); instanceRef.current = null; } - }).catch(() => { if (!cancelled) setRenderError(t("infographic.renderError")); }); + }).catch((caught) => { + console.error("Failed to load @antv/infographic", caught); + if (!cancelled) setRenderError(t("infographic.renderError")); + }); }, 250); return () => { cancelled = true; window.clearTimeout(timer); }; }, [syntax, readOnly, t]); diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 83168454..4c24ca76 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -335,6 +335,15 @@ export default defineConfig({ // before Config is initialized, crashing the lazy diagram editor. // Keep the graph atomic and defer the resulting chunk instead. }, + { + name: "vendor-infographic", + test: /node_modules[\\/]@antv[\\/]infographic[\\/]/, + priority: 39, + // AntV Infographic registers its template and shape catalogs through + // internal registries. Size-based splitting across chunks breaks + // initialization order, causing registry map lookups (e.g. .set) + // to fail on undefined during chunk evaluation. Keep this graph atomic. + }, { name: "vendor-prosemirror", test: /node_modules[\\/](prosemirror-|orderedmap|rope-sequence)[\\/]/,