Skip to content

Commit f01d47c

Browse files
authored
fix(ObjectPage): add safeguards for single section spacer calculation (#5604)
Fixes #5600
1 parent f3625ed commit f01d47c

File tree

1 file changed

+3
-3
lines changed
  • packages/main/src/components/ObjectPage

1 file changed

+3
-3
lines changed

packages/main/src/components/ObjectPage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,18 +468,18 @@ const ObjectPage = forwardRef<HTMLDivElement, ObjectPagePropTypes>((props, ref)
468468
const objectPage = objectPageRef.current;
469469
const sectionNodes = objectPage.querySelectorAll<HTMLDivElement>('[id^="ObjectPageSection"]');
470470
const lastSectionNode = sectionNodes[sectionNodes.length - 1];
471+
const tabContainerContainer = tabContainerContainerRef.current;
471472

472473
const observer = new ResizeObserver(([sectionElement]) => {
473474
const subSections = lastSectionNode.querySelectorAll<HTMLDivElement>('[id^="ObjectPageSubSection"]');
474475
const lastSubSection = subSections[subSections.length - 1];
475476
const lastSubSectionOrSection = lastSubSection ?? sectionElement.target;
476-
477477
if ((currentTabModeSection && !lastSubSection) || (sectionNodes.length === 1 && !lastSubSection)) {
478478
setSectionSpacer(0);
479-
} else {
479+
} else if (!!tabContainerContainer) {
480480
setSectionSpacer(
481481
objectPage.getBoundingClientRect().bottom -
482-
tabContainerContainerRef.current.getBoundingClientRect().bottom -
482+
tabContainerContainer.getBoundingClientRect().bottom -
483483
lastSubSectionOrSection.getBoundingClientRect().height -
484484
TAB_CONTAINER_HEADER_HEIGHT
485485
);

0 commit comments

Comments
 (0)