Skip to content

Commit

Permalink
addressing PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed May 12, 2020
1 parent 010e52d commit 146d887
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions x-pack/plugins/apm/public/hooks/useEnvironments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ENVIRONMENT_NOT_DEFINED,
ENVIRONMENT_ALL
} from '../../common/environment_filter_values';
import { callApmApi } from '../services/rest/createCallApmApi';

export const ALL_OPTION = {
value: ENVIRONMENT_ALL,
Expand Down Expand Up @@ -39,23 +40,20 @@ export function useEnvironments({
start?: string;
end?: string;
}) {
const { data: environments = [], status = 'loading' } = useFetcher(
callApmApi => {
if (start && end) {
return callApmApi({
pathname: '/api/apm/ui_filters/environments',
params: {
query: {
start,
end,
serviceName
}
const { data: environments = [], status = 'loading' } = useFetcher(() => {
if (start && end) {
return callApmApi({
pathname: '/api/apm/ui_filters/environments',
params: {
query: {
start,
end,
serviceName
}
});
}
},
[start, end, serviceName]
);
}
});
}
}, [start, end, serviceName]);

const environmentOptions = useMemo(
() => getEnvironmentOptions(environments),
Expand Down

0 comments on commit 146d887

Please sign in to comment.