Orphan chart drawing remains visible and cannot be deleted
Environment
- Univer CLI:
0.4.0
- Viewer: local Collab Gateway Viewer at
http://127.0.0.1:9123/
- Reproduction package:
harbourline-q3-qbr-deep-ocean.univer
- Target Sheet unit:
Ct1A0c (Harbourline Q3 QBR)
- Worksheet:
Chart Gallery
- Diagnostic worktree:
wt-mshcgd6y-xpojxs (remove-doc-ghost-chart-frame)
Summary
The CLI package contains stale DRAWING_CHART anchors whose chart resources no longer exist. The Viewer still renders the orphan anchors as selectable chart frames behind an embedded Doc. The chart menu offers Delete chart, but deletion has no effect and the frames return after reload.
Steps to reproduce with the attached file
- Unzip
harbourline-q3-qbr-orphan-chart-repro.zip.
- Open the resulting
.univer package in Univer CLI 0.4.0 Viewer.
- Open unit
Ct1A0c and select the Chart Gallery worksheet.
- Select the empty chart frame behind the embedded Doc near rows 5–20.
- Open the chart menu and choose Delete chart.
- Reload the Viewer.
Actual result
- The empty chart frame remains visible and selectable.
- The Viewer identifies it as a chart and continues to offer Delete chart.
sheet.charts.remove(orphanDrawingId) returns false.
sheet.getDrawingLayout() continues to return the orphan DRAWING_CHART entry.
- No public generic drawing-removal API is exposed for deleting the orphan independently of the missing chart resource.
Diagnostic evidence
- Valid chart resources on
Chart Gallery: 12.
- Orphan
DRAWING_CHART anchors present in the drawing layout: 13.
- Three orphan anchors overlap the embedded Doc near row 5.
- All 12 valid charts retained their source ranges and resolved without diagnostics.
- Formula errors after recalculation: 0.
- Key values remained unchanged:
$1,140,562 and $1,405,552.
- The embedded Doc remained present at the same bounds.
Expected result
Choosing Delete chart should remove the selected drawing anchor even if the matching chart resource is already missing.
One of the following would resolve the issue:
- Make Delete chart fall back to deleting the orphan drawing anchor.
- Detect and clean orphan chart drawings when loading a CLI package.
- Expose a public API that removes a Sheet drawing by ID independently of the chart collection.
Temporary workaround
Moving each orphan drawing off-canvas and reducing it to 1 x 1 removes the visible artifact:
sheet.setDrawingPlacement(orphanDrawingId, {
kind: UniverAPI.Enum.SheetDrawingAnchorType.Position,
from: {
row: 0,
column: 0,
rowOffset: -1000,
columnOffset: -1000,
},
width: 1,
height: 1,
});
This only hides the orphan. It does not delete the stale drawing record.
Impact
CLI-generated or edited packages can retain undeletable chart frames that overlap embedded Docs or other floating objects. The UI presents a deletion action that silently cannot complete, leaving the package with persistent orphan drawing records.
Orphan chart drawing remains visible and cannot be deleted
Environment
0.4.0http://127.0.0.1:9123/harbourline-q3-qbr-deep-ocean.univerCt1A0c(Harbourline Q3 QBR)Chart Gallerywt-mshcgd6y-xpojxs(remove-doc-ghost-chart-frame)Summary
The CLI package contains stale
DRAWING_CHARTanchors whose chart resources no longer exist. The Viewer still renders the orphan anchors as selectable chart frames behind an embedded Doc. The chart menu offers Delete chart, but deletion has no effect and the frames return after reload.Steps to reproduce with the attached file
harbourline-q3-qbr-orphan-chart-repro.zip..univerpackage in Univer CLI 0.4.0 Viewer.Ct1A0cand select theChart Galleryworksheet.Actual result
sheet.charts.remove(orphanDrawingId)returnsfalse.sheet.getDrawingLayout()continues to return the orphanDRAWING_CHARTentry.Diagnostic evidence
Chart Gallery: 12.DRAWING_CHARTanchors present in the drawing layout: 13.$1,140,562and$1,405,552.Expected result
Choosing Delete chart should remove the selected drawing anchor even if the matching chart resource is already missing.
One of the following would resolve the issue:
Temporary workaround
Moving each orphan drawing off-canvas and reducing it to
1 x 1removes the visible artifact:This only hides the orphan. It does not delete the stale drawing record.
Impact
CLI-generated or edited packages can retain undeletable chart frames that overlap embedded Docs or other floating objects. The UI presents a deletion action that silently cannot complete, leaving the package with persistent orphan drawing records.