mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-02 01:20:23 +08:00
fix: preserve multi-page diagrams after export (#895)
* fix: preserve multi-page diagrams after export * fix: keep chartXML sourced from autosave to preserve multi-page state The export event's data.xml (xmlsvg format) contains compressed <diagram> payloads, which would break applyDiagramOperations/replaceNodes consumers that need plain <root> elements. Instead of writing export results into chartXML, stop overwriting it entirely: autosave already delivers the full uncompressed multi-page document, and loadDiagram covers AI-driven updates. Also stop overwriting chartXMLRef with the page-only export before sending a chat message, so session persistence never sees single-page XML. Keep the data.xml preference for .drawio file downloads (compressed pages are a valid drawio format). --------- Co-authored-by: dayuan.jiang <jdy.toh@gmail.com>
This commit is contained in:
@@ -830,10 +830,6 @@ export default function ChatPanel({
|
||||
let chartXml = await onFetchChart()
|
||||
chartXml = formatXML(chartXml)
|
||||
|
||||
// Update ref directly to avoid race condition with React's async state update
|
||||
// This ensures edit_diagram has the correct XML before AI responds
|
||||
chartXMLRef.current = chartXml
|
||||
|
||||
// Build user text by concatenating input with pre-extracted text
|
||||
// (Backend only reads first text part, so we must combine them)
|
||||
const parts: any[] = []
|
||||
|
||||
Reference in New Issue
Block a user