@@ -123,19 +123,21 @@ function Overflow<ItemType = any>(
123
123
const mergedRestWidth = Math . max ( prevRestWidth , restWidth ) ;
124
124
125
125
// ================================= Data =================================
126
- const isResponsive = data . length && maxCount === RESPONSIVE ;
126
+ const isResponsive = maxCount === RESPONSIVE ;
127
+ const shouldResponsive = data . length && isResponsive ;
127
128
const invalidate = maxCount === INVALIDATE ;
128
129
129
130
/**
130
131
* When is `responsive`, we will always render rest node to get the real width of it for calculation
131
132
*/
132
133
const showRest =
133
- isResponsive || ( typeof maxCount === 'number' && data . length > maxCount ) ;
134
+ shouldResponsive ||
135
+ ( typeof maxCount === 'number' && data . length > maxCount ) ;
134
136
135
137
const mergedData = useMemo ( ( ) => {
136
138
let items = data ;
137
139
138
- if ( isResponsive ) {
140
+ if ( shouldResponsive ) {
139
141
if ( containerWidth === null && fullySSR ) {
140
142
items = data ;
141
143
} else {
@@ -149,14 +151,14 @@ function Overflow<ItemType = any>(
149
151
}
150
152
151
153
return items ;
152
- } , [ data , itemWidth , containerWidth , maxCount , isResponsive ] ) ;
154
+ } , [ data , itemWidth , containerWidth , maxCount , shouldResponsive ] ) ;
153
155
154
156
const omittedItems = useMemo ( ( ) => {
155
- if ( isResponsive ) {
157
+ if ( shouldResponsive ) {
156
158
return data . slice ( mergedDisplayCount + 1 ) ;
157
159
}
158
160
return data . slice ( mergedData . length ) ;
159
- } , [ data , mergedData , isResponsive , mergedDisplayCount ] ) ;
161
+ } , [ data , mergedData , shouldResponsive , mergedDisplayCount ] ) ;
160
162
161
163
// ================================= Item =================================
162
164
const getKey = useCallback (
@@ -284,7 +286,7 @@ function Overflow<ItemType = any>(
284
286
const displayRest = restReady && ! ! omittedItems . length ;
285
287
286
288
let suffixStyle : React . CSSProperties = { } ;
287
- if ( suffixFixedStart !== null && isResponsive ) {
289
+ if ( suffixFixedStart !== null && shouldResponsive ) {
288
290
suffixStyle = {
289
291
position : 'absolute' ,
290
292
left : suffixFixedStart ,
@@ -294,7 +296,7 @@ function Overflow<ItemType = any>(
294
296
295
297
const itemSharedProps = {
296
298
prefixCls : itemPrefixCls ,
297
- responsive : isResponsive ,
299
+ responsive : shouldResponsive ,
298
300
component : itemComponent ,
299
301
invalidate,
300
302
} ;
@@ -389,6 +391,8 @@ function Overflow<ItemType = any>(
389
391
{ suffix && (
390
392
< Item
391
393
{ ...itemSharedProps }
394
+ responsive = { isResponsive }
395
+ responsiveDisabled = { ! shouldResponsive }
392
396
order = { mergedDisplayCount }
393
397
className = { `${ itemPrefixCls } -suffix` }
394
398
registerSize = { registerSuffixSize }
@@ -403,7 +407,7 @@ function Overflow<ItemType = any>(
403
407
404
408
if ( isResponsive ) {
405
409
overflowNode = (
406
- < ResizeObserver onResize = { onOverflowResize } >
410
+ < ResizeObserver onResize = { onOverflowResize } disabled = { ! shouldResponsive } >
407
411
{ overflowNode }
408
412
</ ResizeObserver >
409
413
) ;
0 commit comments