mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-11 12:09:53 +08:00
fix(mcp-server): recover sessions in one place, and more fixes from the third review
- A session whose state expired was recovered from its auto-save file only for the preview page; the tools built on their older copy and then overwrote the file. They now recover it first (restoreSavedSession). - A preview tab that missed the last AI write pushed its older diagram over the recovered one after a restart. It now shows the recovered diagram and keeps its own copy in History. - An empty record of what the model has seen (after load_diagram or a page tool on unseen changes) no longer lets one page of a multi-page document count for all, and get_diagram counts a page only once found. - History: a thumbnail goes only to the entry it shows, the cached image never belongs to an older diagram, a re-serialized copy adds no entry, and a cleared document with its own pages is kept before a restore. - The root cell id check reads attributes one by one: rack-id="1" or id text inside a label no longer counts. - A compressed page counts as having cells; a saved file that could not be read is never written over.
This commit is contained in:
@@ -156,9 +156,15 @@ describe("markPageSeen", () => {
|
||||
expect(checkEditGate(marked, live).ok).toBe(false)
|
||||
})
|
||||
|
||||
it("counts everything as seen when the model saw nothing before", () => {
|
||||
// It has no old copy of the other pages to edit from
|
||||
it("does not count other pages when the record of what was seen is empty", () => {
|
||||
// Empty also after load_diagram or a page tool on unseen changes,
|
||||
// when the model may still remember an older copy of the pages
|
||||
const live = doc("a1", "b1")
|
||||
expect(markPageSeen("", live, { page_id: "A" })).toBe("")
|
||||
})
|
||||
|
||||
it("counts a one-page document as seen from its only page", () => {
|
||||
const live = `<mxfile>${page("A", "a1")}</mxfile>`
|
||||
expect(markPageSeen("", live, { page_id: "A" })).toBe(live)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user