Skip to content

Commit b7b335a

Browse files
committed
Issue JedWatson#5733: MenuPlacer useLayoutEffect depend on isLoading
1 parent 011a9d9 commit b7b335a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/react-select/src/Select.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ export default class Select<
19611961
};
19621962

19631963
const menuElement = (
1964-
<MenuPlacer {...commonProps} {...menuPlacementProps}>
1964+
<MenuPlacer {...commonProps} {...menuPlacementProps} isLoading={isLoading}>
19651965
{({ ref, placerProps: { placement, maxHeight } }) => (
19661966
<Menu
19671967
{...commonProps}

packages/react-select/src/components/Menu.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ export interface MenuPlacerProps<
266266
MenuPlacementProps {
267267
/** The children to be rendered. */
268268
children: (childrenProps: ChildrenProps) => ReactElement;
269+
isLoading: boolean;
269270
}
270271

271272
function alignToControl(placement: CoercedMenuPlacement) {
@@ -317,6 +318,7 @@ export const MenuPlacer = <
317318
) => {
318319
const {
319320
children,
321+
isLoading,
320322
minMenuHeight,
321323
maxMenuHeight,
322324
menuPlacement,
@@ -353,6 +355,7 @@ export const MenuPlacer = <
353355
setPlacement(state.placement);
354356
setPortalPlacement?.(state.placement);
355357
}, [
358+
isLoading,
356359
maxMenuHeight,
357360
menuPlacement,
358361
menuPosition,

0 commit comments

Comments
 (0)