From f01d47cf781914d64c828de71e1d8d43bd217f0d Mon Sep 17 00:00:00 2001 From: Lukas Harbarth Date: Tue, 19 Mar 2024 08:39:22 +0100 Subject: [PATCH] fix(ObjectPage): add safeguards for single section spacer calculation (#5604) Fixes #5600 --- packages/main/src/components/ObjectPage/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/main/src/components/ObjectPage/index.tsx b/packages/main/src/components/ObjectPage/index.tsx index 472d8939a01..1488d54bf4d 100644 --- a/packages/main/src/components/ObjectPage/index.tsx +++ b/packages/main/src/components/ObjectPage/index.tsx @@ -468,18 +468,18 @@ const ObjectPage = forwardRef((props, ref) const objectPage = objectPageRef.current; const sectionNodes = objectPage.querySelectorAll('[id^="ObjectPageSection"]'); const lastSectionNode = sectionNodes[sectionNodes.length - 1]; + const tabContainerContainer = tabContainerContainerRef.current; const observer = new ResizeObserver(([sectionElement]) => { const subSections = lastSectionNode.querySelectorAll('[id^="ObjectPageSubSection"]'); const lastSubSection = subSections[subSections.length - 1]; const lastSubSectionOrSection = lastSubSection ?? sectionElement.target; - if ((currentTabModeSection && !lastSubSection) || (sectionNodes.length === 1 && !lastSubSection)) { setSectionSpacer(0); - } else { + } else if (!!tabContainerContainer) { setSectionSpacer( objectPage.getBoundingClientRect().bottom - - tabContainerContainerRef.current.getBoundingClientRect().bottom - + tabContainerContainer.getBoundingClientRect().bottom - lastSubSectionOrSection.getBoundingClientRect().height - TAB_CONTAINER_HEADER_HEIGHT );