From 6755b2a1f373649333714fa2b637f75e4bba1419 Mon Sep 17 00:00:00 2001 From: rahulramesha Date: Wed, 7 Feb 2024 16:13:10 +0530 Subject: [PATCH] fix height glitch while rendered rows adjust to default height --- web/components/core/render-if-visible-HOC.tsx | 8 ++++---- web/components/issues/issue-layouts/kanban/block.tsx | 2 +- web/components/issues/issue-layouts/list/block.tsx | 2 +- web/components/issues/issue-layouts/list/blocks-list.tsx | 2 +- .../issue-layouts/spreadsheet/spreadsheet-table.tsx | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/web/components/core/render-if-visible-HOC.tsx b/web/components/core/render-if-visible-HOC.tsx index b65fbbc36..626c76ad7 100644 --- a/web/components/core/render-if-visible-HOC.tsx +++ b/web/components/core/render-if-visible-HOC.tsx @@ -2,7 +2,7 @@ import { cn } from "helpers/common.helper"; import React, { useState, useRef, useEffect, ReactNode, MutableRefObject } from "react"; type Props = { - defaultHeight?: number; + defaultHeight?: string; verticalOffset?: number; horizonatlOffset?: number; root?: MutableRefObject; @@ -19,7 +19,7 @@ type Props = { const RenderIfVisible: React.FC = (props) => { const { - defaultHeight = 300, + defaultHeight = "300px", root, verticalOffset = 50, horizonatlOffset = 0, @@ -35,7 +35,7 @@ const RenderIfVisible: React.FC = (props) => { } = props; const defaultVisible = !!getShouldRender && getShouldRender(index); const [shouldVisible, setShouldVisible] = useState(alwaysRender || defaultVisible); - const placeholderHeight = useRef(defaultHeight); + const placeholderHeight = useRef(defaultHeight); const intersectionRef = useRef(null); const isVisible = alwaysRender || shouldVisible; @@ -78,7 +78,7 @@ const RenderIfVisible: React.FC = (props) => { // Set height after render useEffect(() => { if (intersectionRef.current && isVisible) { - placeholderHeight.current = intersectionRef.current.offsetHeight; + placeholderHeight.current = `${intersectionRef.current.offsetHeight}px`; } }, [isVisible, intersectionRef, alwaysRender, pauseHeightUpdateWhileRendering]); diff --git a/web/components/issues/issue-layouts/kanban/block.tsx b/web/components/issues/issue-layouts/kanban/block.tsx index ed819c7a0..7939f6662 100644 --- a/web/components/issues/issue-layouts/kanban/block.tsx +++ b/web/components/issues/issue-layouts/kanban/block.tsx @@ -138,7 +138,7 @@ export const KanbanIssueBlock: React.FC = memo((props) => { = observer((props: IssueBlock return (
diff --git a/web/components/issues/issue-layouts/list/blocks-list.tsx b/web/components/issues/issue-layouts/list/blocks-list.tsx index 1e1126e3f..8e7386257 100644 --- a/web/components/issues/issue-layouts/list/blocks-list.tsx +++ b/web/components/issues/issue-layouts/list/blocks-list.tsx @@ -27,7 +27,7 @@ export const IssueBlocksList: FC = (props) => { return ( { } index={index}