mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
fix(web): allow foreignObject in DOMPurify SVG, remove leftover loop code
- Add ADD_TAGS: ['foreignObject'] to all DOMPurify.sanitize calls — Mermaid uses foreignObject for HTML text labels inside flowchart nodes. The SVG profile was stripping them, causing empty boxes. - Remove leftover sub-batch loop lines from prepared statement hoist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
83ec256cec
commit
fd61cd2990
2 changed files with 1 additions and 7 deletions
|
|
@ -71,7 +71,7 @@ export const MermaidDiagram = ({ code }: MermaidDiagramProps) => {
|
|||
|
||||
// Render the diagram
|
||||
const { svg: renderedSvg } = await mermaid.render(id, code.trim());
|
||||
const sanitizedSvg = DOMPurify.sanitize(renderedSvg, { USE_PROFILES: { svg: true, svgFilters: true } });
|
||||
const sanitizedSvg = DOMPurify.sanitize(renderedSvg, { USE_PROFILES: { svg: true, svgFilters: true }, ADD_TAGS: ['foreignObject'] });
|
||||
setSvg(sanitizedSvg);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
|
|
|
|||
|
|
@ -267,12 +267,6 @@ export const loadGraphToLbug = async (
|
|||
} finally {
|
||||
await stmt.close();
|
||||
}
|
||||
|
||||
// Yield to event loop between sub-batches
|
||||
if (i + SUB_BATCH_SIZE < rels.length) {
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue