Skip to content

Commit 411fb3b

Browse files
committed
fix: make changes of ssr full only affect code that set to be responsive
1 parent 0c7a755 commit 411fb3b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Overflow.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ function Overflow<ItemType = any>(
302302
// ================================ Render ================================
303303
const displayRest = restReady && !!omittedItems.length;
304304

305-
const isFullySSRAndFirstRender = fullySSR && containerWidth === null;
305+
const isFullySSRResponsiveFirstRender =
306+
fullySSR && shouldResponsive && containerWidth === null;
306307
const fullySSRFirstRenderStyle: React.CSSProperties = {
307308
maxWidth: 0,
308309
padding: 0,
@@ -311,7 +312,7 @@ function Overflow<ItemType = any>(
311312
overflowX: 'hidden',
312313
};
313314

314-
let suffixStyle: React.CSSProperties = isFullySSRAndFirstRender
315+
let suffixStyle: React.CSSProperties = isFullySSRResponsiveFirstRender
315316
? fullySSRFirstRenderStyle
316317
: {};
317318
if (suffixFixedStart !== null && shouldResponsive) {
@@ -327,7 +328,9 @@ function Overflow<ItemType = any>(
327328
responsive: shouldResponsive,
328329
component: itemComponent,
329330
invalidate,
330-
style: isFullySSRAndFirstRender ? fullySSRFirstRenderStyle : undefined,
331+
style: isFullySSRResponsiveFirstRender
332+
? fullySSRFirstRenderStyle
333+
: undefined,
331334
};
332335

333336
// >>>>> Choice render fun by `renderRawItem`
@@ -338,7 +341,7 @@ function Overflow<ItemType = any>(
338341
// in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
339342
// 1) at initial render; 2) its corresponding width is valid and pass the index check
340343
const shouldDisplay = fullySSR
341-
? isFullySSRAndFirstRender ||
344+
? isFullySSRResponsiveFirstRender ||
342345
(isIdxCheckPass && getItemWidth(index) > 0)
343346
: isIdxCheckPass;
344347
return (
@@ -363,7 +366,7 @@ function Overflow<ItemType = any>(
363366
// in `ssr="full"` case, item's `display` will be set to `true` when either condition is met:
364367
// 1) at initial render; 2) its corresponding width is valid and pass the index check
365368
const shouldDisplay = fullySSR
366-
? isFullySSRAndFirstRender ||
369+
? isFullySSRResponsiveFirstRender ||
367370
(isIdxCheckPass && getItemWidth(index) > 0)
368371
: isIdxCheckPass;
369372
return (

0 commit comments

Comments
 (0)