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(ui): float-dom error disposed on zen-mode (#5093)

ZhangWei615e709e3626
diff --git a/packages/ui/src/views/components/dom/FloatDom.tsx b/packages/ui/src/views/components/dom/FloatDom.tsx
index 155f14300e..11063ec463 100644
--- a/packages/ui/src/views/components/dom/FloatDom.tsx
+++ b/packages/ui/src/views/components/dom/FloatDom.tsx
@@ -160,7 +160,8 @@ export const FloatDom = ({ unitId }: { unitId?: string }) => {
const instanceService = useDependency(IUniverInstanceService);
const domLayerService = useDependency(CanvasFloatDomService);
const layers = useObservable(domLayerService.domLayers$);
- const currentUnitId = unitId || instanceService.getFocusedUnit()?.getUnitId();
+ const focusUnit = useObservable(instanceService.focused$);
+ const currentUnitId = unitId || focusUnit;
return layers?.filter((layer) => layer[1].unitId === currentUnitId)?.map((layer) => (
<FloatDomSingle