Skip to content

Commit

Permalink
Memoize dataControlFactories
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Jul 2, 2024
1 parent 703abcb commit d4acc64
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ const CompatibleControlTypesComponent = ({
selectedControlType?: string;
setSelectedControlType: (type: string) => void;
}) => {
const dataControlFactories = getAllControlTypes()
.map((type) => getControlFactory(type))
.filter((factory) => {
return isDataControlFactory(factory);
});
const dataControlFactories = useMemo(() => {
return getAllControlTypes()
.map((type) => getControlFactory(type))
.filter((factory) => {
return isDataControlFactory(factory);
});
}, []);

return (
<EuiKeyPadMenu data-test-subj={`controlTypeMenu`} aria-label={'type'}>
Expand Down

0 comments on commit d4acc64

Please sign in to comment.