Skip to content

Visualize Your Ideas With Code

fix(ui): fix collapse (#698)

Jacob6bd8703ec9b1
diff --git a/packages/ui/src/components/layout/Collapse.tsx b/packages/ui/src/components/layout/Collapse.tsx
index e19de909..1a167034 100644
--- a/packages/ui/src/components/layout/Collapse.tsx
+++ b/packages/ui/src/components/layout/Collapse.tsx
@@ -60,7 +60,9 @@ function AnimatedCollapse({open, children, className, ...rest}: CollapseProps) {
ref.current.dataset.open = open ? 'true' : 'false';
if (open) {
- ref.current.style.height = `${ref.current.scrollHeight}px`;
+ if (ref.current.style.height !== 'auto') {
+ ref.current.style.height = `${ref.current.scrollHeight}px`;
+ }
} else {
if (ref.current.style.height === 'auto') {
ref.current.style.height = `${ref.current.scrollHeight}px`;