Skip to content

Commit cf78343

Browse files
authored
fix: No update if count is same (#24)
1 parent e4b1bf1 commit cf78343

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Overflow.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ function Overflow<ItemType = any>(
177177
);
178178

179179
function updateDisplayCount(count: number, notReady?: boolean) {
180+
// React 18 will sync render even when the value is same in some case.
181+
// We take `mergedData` as deps which may cause dead loop if it's dynamic generate.
182+
// ref: https://github.com/ant-design/ant-design/issues/36559
183+
if (displayCount === count) {
184+
return;
185+
}
186+
180187
setDisplayCount(count);
181188
if (!notReady) {
182189
setRestReady(count < data.length - 1);

0 commit comments

Comments
 (0)