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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(sheet): resizeObserver disconnect when unmount in sheetBarTabs (#4228)
Dushusir2df18629415e
diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsxindex a3555e8fb9..791076ce56 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarTabs.tsx@@ -105,7 +105,7 @@ export function SheetBarTabs() {useEffect(() => {updateSheetItems();- const slideTabBar = setupSlideTabBarInit();+ const { slideTabBar, disconnectResizeObserver } = setupSlideTabBarInit();const disposable = setupStatusUpdate();const subscribeList = [setupSubscribeScroll(),@@ -118,6 +118,7 @@ export function SheetBarTabs() {disposable.dispose();slideTabBar.destroy();subscribeList.forEach((subscribe) => subscribe.unsubscribe());+ disconnectResizeObserver && disconnectResizeObserver();};}, [resetOrder, workbook]);@@ -199,9 +200,9 @@ export function SheetBarTabs() {slideTabBarRef.current.slideTabBar = slideTabBar;// FIXME@Dushusir: First time asynchronous rendering will cause flickering problems- resizeInit(slideTabBar);+ const disconnectResizeObserver = resizeInit(slideTabBar);- return slideTabBar;+ return { slideTabBar, disconnectResizeObserver };};const config = configService.getConfig<IUniverUIConfig>(UI_PLUGIN_CONFIG_KEY);@@ -385,6 +386,9 @@ export function SheetBarTabs() {// Start the observerobserver.observe(slideTabBarContainer);++ // Return the cleanup function that disconnects the observer+ return () => observer.disconnect();};const onVisibleChange = (visible: boolean) => {