catalog-react: fix scroll reset

Signed-off-by: Vincenzo Scamporlino <vincenzos@spotify.com>
This commit is contained in:
Vincenzo Scamporlino
2024-11-25 10:21:35 +01:00
parent 54916f2446
commit 5a5bdda625
@@ -42,6 +42,7 @@ import { withStyles } from '@material-ui/core/styles';
import { useEntityPresentation } from '../../apis';
import { catalogReactTranslationRef } from '../../translation';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { PopperProps } from '@material-ui/core/Popper';
/** @public */
export type CatalogReactEntityOwnerPickerClassKey = 'input';
@@ -92,6 +93,10 @@ export type EntityOwnerPickerProps = {
mode?: 'owners-only' | 'all';
};
const Popper = React.memo(function Popper({ children }: PopperProps) {
return <div>{children as ReactNode}</div>;
});
function RenderOptionLabel(props: { entity: Entity; isSelected: boolean }) {
const classes = useStyles();
const isGroup = props.entity.kind.toLocaleLowerCase('en-US') === 'group';
@@ -188,9 +193,7 @@ export const EntityOwnerPicker = (props?: EntityOwnerPickerProps) => {
<Typography className={classes.label} variant="button" component="label">
{t('entityOwnerPicker.title')}
<Autocomplete
PopperComponent={popperProps => (
<div {...popperProps}>{popperProps.children as ReactNode}</div>
)}
PopperComponent={Popper}
multiple
disableCloseOnSelect
loading={loading}