Skip to content

Commit 5ef6a82

Browse files
authored
fix: improve the timing when to check empty of panels (#233)
1 parent 088edd2 commit 5ef6a82

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/collapse/index.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export function Collapse(props: ICollapseProps) {
9393
}, []);
9494

9595
React.useLayoutEffect(() => {
96+
// It's necessary to check panel's empty before calculate every panel
9697
filterData.forEach((panel) => {
9798
const isActive = activePanelKeys.includes(panel.id);
9899
let isEmpty = true;
@@ -103,6 +104,9 @@ export function Collapse(props: ICollapseProps) {
103104
isEmpty = !contentDom?.hasChildNodes();
104105
}
105106
panel._isEmpty = isEmpty;
107+
});
108+
109+
filterData.forEach((panel) => {
106110
const [height, top] = calcPosition(
107111
activePanelKeys,
108112
panel,

0 commit comments

Comments
 (0)