@@ -302,7 +302,18 @@ function Overflow<ItemType = any>(
302302 // ================================ Render ================================
303303 const displayRest = restReady && ! ! omittedItems . length ;
304304
305- let suffixStyle : React . CSSProperties = { } ;
305+ const isFullySSRAndFirstRender = fullySSR && containerWidth === null ;
306+ const fullySSRFirstRenderStyle : React . CSSProperties = {
307+ maxWidth : 0 ,
308+ padding : 0 ,
309+ margin : 0 ,
310+ borderWidth : 0 ,
311+ overflowX : 'hidden' ,
312+ } ;
313+
314+ let suffixStyle : React . CSSProperties = isFullySSRAndFirstRender
315+ ? fullySSRFirstRenderStyle
316+ : { } ;
306317 if ( suffixFixedStart !== null && shouldResponsive ) {
307318 suffixStyle = {
308319 position : 'absolute' ,
@@ -316,13 +327,20 @@ function Overflow<ItemType = any>(
316327 responsive : shouldResponsive ,
317328 component : itemComponent ,
318329 invalidate,
330+ style : isFullySSRAndFirstRender ? fullySSRFirstRenderStyle : undefined ,
319331 } ;
320332
321333 // >>>>> Choice render fun by `renderRawItem`
322334 const internalRenderItemNode = renderRawItem
323335 ? ( item : ItemType , index : number ) => {
324336 const key = getKey ( item , index ) ;
325-
337+ const isIdxCheckPass = index <= mergedDisplayCount ;
338+ // in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
339+ // 1) at initial render; 2) its corresponding width is valid and pass the index check
340+ const shouldDisplay = fullySSR
341+ ? isFullySSRAndFirstRender ||
342+ ( isIdxCheckPass && getItemWidth ( index ) > 0 )
343+ : isIdxCheckPass ;
326344 return (
327345 < OverflowContext . Provider
328346 key = { key }
@@ -332,7 +350,7 @@ function Overflow<ItemType = any>(
332350 item,
333351 itemKey : key ,
334352 registerSize,
335- display : index <= mergedDisplayCount ,
353+ display : shouldDisplay ,
336354 } }
337355 >
338356 { renderRawItem ( item , index ) }
@@ -341,7 +359,13 @@ function Overflow<ItemType = any>(
341359 }
342360 : ( item : ItemType , index : number ) => {
343361 const key = getKey ( item , index ) ;
344-
362+ const isIdxCheckPass = index <= mergedDisplayCount ;
363+ // in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
364+ // 1) at initial render; 2) its corresponding width is valid and pass the index check
365+ const shouldDisplay = fullySSR
366+ ? isFullySSRAndFirstRender ||
367+ ( isIdxCheckPass && getItemWidth ( index ) > 0 )
368+ : isIdxCheckPass ;
345369 return (
346370 < Item
347371 { ...itemSharedProps }
@@ -351,7 +375,7 @@ function Overflow<ItemType = any>(
351375 renderItem = { mergedRenderItem }
352376 itemKey = { key }
353377 registerSize = { registerSize }
354- display = { index <= mergedDisplayCount }
378+ display = { shouldDisplay }
355379 />
356380 ) ;
357381 } ;
0 commit comments