Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheets-note-ui): note error resize to zero when hide (#5179)

ZhangWei735b7aaeae4e
diff --git a/packages/sheets-note-ui/src/views/note.tsx b/packages/sheets-note-ui/src/views/note.tsx
index 6f347e88fe..71bdfea2e1 100644
--- a/packages/sheets-note-ui/src/views/note.tsx
+++ b/packages/sheets-note-ui/src/views/note.tsx
@@ -95,6 +95,7 @@ export const SheetsNote = (props: { popup: IPopup<{ location: ISheetLocationBase
if (!entry) return;
const { width, height } = entry.contentRect;
+ if (width === 0 && height === 0) return;
const newNote = { ...note, width, height };
setNote(newNote);
updateNote(newNote);
@@ -103,6 +104,7 @@ export const SheetsNote = (props: { popup: IPopup<{ location: ISheetLocationBase
resizeObserver.observe(textarea);
return () => {
+ resizeObserver.unobserve(textarea);
resizeObserver.disconnect();
};
}, [note.note]); // Only re-run when note content changes