You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unknown structure name silently falls back or hangs SSR (no validation error) #272
An unknown structure name in infographic syntax is never validated. Depending on the name, the render either:
Silently falls back to a degraded render — e.g. infographic mindmap (not a registered structure; only hierarchy-mindmap exists) renders without any error, but drops the root label and produces a different layout than the real template.
Hangs SSR until the internal 10 s timeout — e.g. infographic nosuchtemplate never fires loaded, so renderToString() rejects with the generic SSR render timeout instead of a descriptive error.
Reproduction
@antv/infographic@0.2.20, Node 22:
const{ renderToString }=require('@antv/infographic/ssr');// Case 1 — silent fallback, wrong output (root label missing):awaitrenderToString('infographic mindmap\n\ndata\n root\n label Root\n children\n - label Alpha\n - label Beta\n');// resolves OK, but output has no "Root" label and a different layout than hierarchy-mindmap// Case 2 — SSR hang → generic timeout:awaitrenderToString('infographic nosuchtemplate\n\ndata\n a: 1\n');// rejects after 10 s with: Error: SSR render timeout
For comparison, the correct name renders everything as expected:
awaitrenderToString('infographic hierarchy-mindmap\n\ndata\n root\n label Root\n children\n - label Alpha\n - label Beta\n');// OK — Root, Alpha, Beta all present
Expected behavior
An unknown structure/item/title type should fail fast with a descriptive error, e.g. unknown structure: "mindmap" (did you mean "hierarchy-mindmap"? known: hierarchy-mindmap, list-…, chart-…), instead of silently degrading the output or surfacing as a 10-second SSR timeout.
Root cause
lib/options/parser.js → parseDesignStructure():
conststructure=(0,designs_1.getStructure)(type);if(!structure)returnnull;// ← unknown type silently becomes null
The registry lookup miss is swallowed; downstream has no structure component and either falls back to a default or (in SSR, lib/ssr/renderer.js) never emits the loaded event, so the 10 s timer rejects with SSR render timeout.
Environment
@antv/infographic 0.2.20
Node 22, server-side (renderToString from @antv/infographic/ssr)
Verified both in a minimal script and through a rendering service built on the SSR API
Activity