Skip to content

Commit

Permalink
remove side effect
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Dec 17, 2019
1 parent fba09e9 commit cb7036f
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { EuiFilterGroup } from '@elastic/eui';
import React from 'react';
import React, { useEffect } from 'react';
import { get } from 'lodash';
import { i18n } from '@kbn/i18n';
import { FilterBar as FilterBarType } from '../../../../common/graphql/types';
Expand All @@ -21,7 +21,7 @@ interface FilterBarQueryResult {
interface FilterBarDropdownsProps {
currentFilter: string;
onFilterUpdate: (kuery: string) => void;
setFilters: Function;
setFilters: (filters: Map<string, string[]>) => any;
}

type Props = UptimeGraphQLQueryProps<FilterBarQueryResult> & FilterBarDropdownsProps;
Expand Down Expand Up @@ -68,7 +68,9 @@ export const FilterGroupComponent = ({

const getSelectedItems = (fieldName: string) => filterKueries.get(fieldName) || [];

setFilters(filterKueries);
useEffect(() => {
setFilters(filterKueries);
}, [filterKueries]);

const filterPopoverProps: FilterPopoverProps[] = [
{
Expand Down

0 comments on commit cb7036f

Please sign in to comment.