Skip to content

Commit

Permalink
Issue JedWatson#5733: MenuPlacer useLayoutEffect depend on isLoading
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-nicka committed Oct 4, 2023
1 parent b53e647 commit 0b3c34f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ export default class Select<
};

const menuElement = (
<MenuPlacer {...commonProps} {...menuPlacementProps}>
<MenuPlacer {...commonProps} {...menuPlacementProps} isLoading={isLoading}>
{({ ref, placerProps: { placement, maxHeight } }) => (
<Menu
{...commonProps}
Expand Down
3 changes: 3 additions & 0 deletions packages/react-select/src/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export interface MenuPlacerProps<
MenuPlacementProps {
/** The children to be rendered. */
children: (childrenProps: ChildrenProps) => ReactElement;
isLoading: boolean;
}

function alignToControl(placement: CoercedMenuPlacement) {
Expand Down Expand Up @@ -317,6 +318,7 @@ export const MenuPlacer = <
) => {
const {
children,
isLoading,
minMenuHeight,
maxMenuHeight,
menuPlacement,
Expand Down Expand Up @@ -353,6 +355,7 @@ export const MenuPlacer = <
setPlacement(state.placement);
setPortalPlacement?.(state.placement);
}, [
isLoading,
maxMenuHeight,
menuPlacement,
menuPosition,
Expand Down

0 comments on commit 0b3c34f

Please sign in to comment.