@@ -302,7 +302,19 @@ function Overflow<ItemType = any>(
302302 // ================================ Render ================================
303303 const displayRest = restReady && ! ! omittedItems . length ;
304304
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+ : { } ;
306318 if ( suffixFixedStart !== null && shouldResponsive ) {
307319 suffixStyle = {
308320 position : 'absolute' ,
@@ -316,13 +328,22 @@ function Overflow<ItemType = any>(
316328 responsive : shouldResponsive ,
317329 component : itemComponent ,
318330 invalidate,
331+ style : isFullySSRResponsiveFirstRender
332+ ? fullySSRFirstRenderStyle
333+ : undefined ,
319334 } ;
320335
321336 // >>>>> Choice render fun by `renderRawItem`
322337 const internalRenderItemNode = renderRawItem
323338 ? ( item : ItemType , index : number ) => {
324339 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 ;
326347 return (
327348 < OverflowContext . Provider
328349 key = { key }
@@ -332,7 +353,7 @@ function Overflow<ItemType = any>(
332353 item,
333354 itemKey : key ,
334355 registerSize,
335- display : index <= mergedDisplayCount ,
356+ display : shouldDisplay ,
336357 } }
337358 >
338359 { renderRawItem ( item , index ) }
@@ -341,7 +362,13 @@ function Overflow<ItemType = any>(
341362 }
342363 : ( item : ItemType , index : number ) => {
343364 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 ;
345372 return (
346373 < Item
347374 { ...itemSharedProps }
@@ -351,7 +378,7 @@ function Overflow<ItemType = any>(
351378 renderItem = { mergedRenderItem }
352379 itemKey = { key }
353380 registerSize = { registerSize }
354- display = { index <= mergedDisplayCount }
381+ display = { shouldDisplay }
355382 />
356383 ) ;
357384 } ;
0 commit comments