Skip to content

Commit

Permalink
Fixes infinite useEffect loop useFetchIndex hook because non memoized…
Browse files Browse the repository at this point in the history
… value
  • Loading branch information
dasansol92 committed Apr 26, 2021
1 parent 74f9c91 commit 3836333
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export const EventFiltersForm: React.FC<EventFiltersFormProps> = memo(
const dispatch = useDispatch<Dispatch<AppAction>>();
const exception = useEventFiltersSelector(getFormEntry);

const [isIndexPatternLoading, { indexPatterns }] = useFetchIndex(['logs-endpoint.events.*']);
// This value has to be memoized to avoid infinite useEffect loop on useFetchIndex
const indexNames = useMemo(() => ['logs-endpoint.events.*'], []);
const [isIndexPatternLoading, { indexPatterns }] = useFetchIndex(indexNames);

const osOptions: Array<EuiSuperSelectOption<OperatingSystem>> = useMemo(
() => OPERATING_SYSTEMS.map((os) => ({ value: os, inputDisplay: OS_TITLES[os] })),
Expand Down

0 comments on commit 3836333

Please sign in to comment.