@@ -302,7 +302,19 @@ function Overflow<ItemType = any>(
302
302
// ================================ Render ================================
303
303
const displayRest = restReady && ! ! omittedItems . length ;
304
304
305
- let suffixStyle : React . CSSProperties = { } ;
305
+ const isFullySSRResponsiveFirstRender =
306
+ fullySSR && shouldResponsive && containerWidth === null ;
307
+ const fullySSRFirstRenderStyle : React . CSSProperties = {
308
+ maxWidth : 0 ,
309
+ padding : 0 ,
310
+ margin : 0 ,
311
+ borderWidth : 0 ,
312
+ overflowX : 'hidden' ,
313
+ } ;
314
+
315
+ let suffixStyle : React . CSSProperties = isFullySSRResponsiveFirstRender
316
+ ? fullySSRFirstRenderStyle
317
+ : { } ;
306
318
if ( suffixFixedStart !== null && shouldResponsive ) {
307
319
suffixStyle = {
308
320
position : 'absolute' ,
@@ -316,13 +328,22 @@ function Overflow<ItemType = any>(
316
328
responsive : shouldResponsive ,
317
329
component : itemComponent ,
318
330
invalidate,
331
+ style : isFullySSRResponsiveFirstRender
332
+ ? fullySSRFirstRenderStyle
333
+ : undefined ,
319
334
} ;
320
335
321
336
// >>>>> Choice render fun by `renderRawItem`
322
337
const internalRenderItemNode = renderRawItem
323
338
? ( item : ItemType , index : number ) => {
324
339
const key = getKey ( item , index ) ;
325
-
340
+ const isIdxCheckPass = index <= mergedDisplayCount ;
341
+ // in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
342
+ // 1) at initial render; 2) its corresponding width is valid and pass the index check
343
+ const shouldDisplay = fullySSR
344
+ ? isFullySSRResponsiveFirstRender ||
345
+ ( isIdxCheckPass && getItemWidth ( index ) > 0 )
346
+ : isIdxCheckPass ;
326
347
return (
327
348
< OverflowContext . Provider
328
349
key = { key }
@@ -332,7 +353,7 @@ function Overflow<ItemType = any>(
332
353
item,
333
354
itemKey : key ,
334
355
registerSize,
335
- display : index <= mergedDisplayCount ,
356
+ display : shouldDisplay ,
336
357
} }
337
358
>
338
359
{ renderRawItem ( item , index ) }
@@ -341,7 +362,13 @@ function Overflow<ItemType = any>(
341
362
}
342
363
: ( item : ItemType , index : number ) => {
343
364
const key = getKey ( item , index ) ;
344
-
365
+ const isIdxCheckPass = index <= mergedDisplayCount ;
366
+ // in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
367
+ // 1) at initial render; 2) its corresponding width is valid and pass the index check
368
+ const shouldDisplay = fullySSR
369
+ ? isFullySSRResponsiveFirstRender ||
370
+ ( isIdxCheckPass && getItemWidth ( index ) > 0 )
371
+ : isIdxCheckPass ;
345
372
return (
346
373
< Item
347
374
{ ...itemSharedProps }
@@ -351,7 +378,7 @@ function Overflow<ItemType = any>(
351
378
renderItem = { mergedRenderItem }
352
379
itemKey = { key }
353
380
registerSize = { registerSize }
354
- display = { index <= mergedDisplayCount }
381
+ display = { shouldDisplay }
355
382
/>
356
383
) ;
357
384
} ;
0 commit comments