Skip to content

Commit 2ddc8cf

Browse files
[APM] Blank page when selecting a future time range (#87298) (#88306)
* fixing blank page * fixing blank page * addressing PR comments Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
1 parent d7ad823 commit 2ddc8cf

18 files changed

Lines changed: 115 additions & 50 deletions

File tree

x-pack/plugins/apm/public/components/app/ServiceMap/Popover/ServiceStatsFetcher.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export function ServiceStatsFetcher({
5656
}
5757
);
5858

59-
const isLoading =
60-
status === FETCH_STATUS.PENDING || status === FETCH_STATUS.LOADING;
59+
const isLoading = status === FETCH_STATUS.LOADING;
6160

6261
if (isLoading) {
6362
return <LoadingSpinner />;

x-pack/plugins/apm/public/components/app/ServiceMap/index.test.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import React, { ReactNode } from 'react';
1111
import { createKibanaReactContext } from 'src/plugins/kibana_react/public';
1212
import { License } from '../../../../../licensing/common/license';
1313
import { EuiThemeProvider } from '../../../../../observability/public';
14-
import { FETCH_STATUS } from '../../../../../observability/public/hooks/use_fetcher';
1514
import { MockApmPluginContextWrapper } from '../../../context/apm_plugin/mock_apm_plugin_context';
1615
import { LicenseContext } from '../../../context/license/license_context';
1716
import * as useFetcherModule from '../../../hooks/use_fetcher';
@@ -92,7 +91,7 @@ describe('ServiceMap', () => {
9291
jest.spyOn(useFetcherModule, 'useFetcher').mockReturnValueOnce({
9392
data: { elements: [] },
9493
refetch: () => {},
95-
status: FETCH_STATUS.SUCCESS,
94+
status: useFetcherModule.FETCH_STATUS.SUCCESS,
9695
});
9796

9897
expect(

x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/add_environments.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export function AddEnvironments({
7171
);
7272
}
7373

74-
const isLoading =
75-
status === FETCH_STATUS.PENDING || status === FETCH_STATUS.LOADING;
74+
const isLoading = status === FETCH_STATUS.LOADING;
7675
return (
7776
<EuiPanel>
7877
<EuiTitle>

x-pack/plugins/apm/public/components/app/Settings/anomaly_detection/jobs_list.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ export function JobsList({ data, status, onAddEnvironments }: Props) {
124124

125125
function getNoItemsMessage({ status }: { status: FETCH_STATUS }) {
126126
// loading state
127-
const isLoading =
128-
status === FETCH_STATUS.PENDING || status === FETCH_STATUS.LOADING;
127+
const isLoading = status === FETCH_STATUS.LOADING;
129128
if (isLoading) {
130129
return <LoadingStatePrompt />;
131130
}

x-pack/plugins/apm/public/components/app/service_details/service_icons/icon_popover.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ export function IconPopover({
3535
if (!icon) {
3636
return null;
3737
}
38-
const isLoading =
39-
detailsFetchStatus === FETCH_STATUS.LOADING ||
40-
detailsFetchStatus === FETCH_STATUS.PENDING;
41-
38+
const isLoading = detailsFetchStatus === FETCH_STATUS.LOADING;
4239
return (
4340
<EuiPopover
4441
anchorPosition="downCenter"

x-pack/plugins/apm/public/components/app/service_details/service_icons/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ export function ServiceIcons({ serviceName }: Props) {
9494
[selectedIconPopover, serviceName, start, end, uiFilters]
9595
);
9696

97-
const isLoading =
98-
!icons &&
99-
(iconsFetchStatus === FETCH_STATUS.LOADING ||
100-
iconsFetchStatus === FETCH_STATUS.PENDING);
97+
const isLoading = !icons && iconsFetchStatus === FETCH_STATUS.LOADING;
10198

10299
if (isLoading) {
103100
return <EuiLoadingSpinner data-test-subj="loading" />;

x-pack/plugins/apm/public/components/app/service_overview/service_overview_instances_table/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ export function ServiceOverviewInstancesTable({ serviceName }: Props) {
230230
memoryUsageValue: item.memoryUsage?.value ?? 0,
231231
}));
232232

233-
const isLoading =
234-
status === FETCH_STATUS.LOADING || status === FETCH_STATUS.PENDING;
233+
const isLoading = status === FETCH_STATUS.LOADING;
235234

236235
return (
237236
<EuiFlexGroup direction="column" gutterSize="s">

x-pack/plugins/apm/public/components/app/transaction_overview/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
8383
typeof LocalUIFilters
8484
> = useMemo(
8585
() => ({
86+
shouldFetch: !!transactionType,
8687
filterNames: [
8788
'transactionResult',
8889
'host',
@@ -101,7 +102,7 @@ export function TransactionOverview({ serviceName }: TransactionOverviewProps) {
101102

102103
// TODO: improve urlParams typings.
103104
// `serviceName` or `transactionType` will never be undefined here, and this check should not be needed
104-
if (!serviceName || !transactionType) {
105+
if (!serviceName) {
105106
return null;
106107
}
107108

x-pack/plugins/apm/public/components/shared/LocalUIFilters/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface Props {
2424
params?: Record<string, string | number | boolean | undefined>;
2525
showCount?: boolean;
2626
children?: React.ReactNode;
27+
shouldFetch?: boolean;
2728
}
2829

2930
const ButtonWrapper = styled.div`
@@ -36,11 +37,13 @@ function LocalUIFilters({
3637
filterNames,
3738
children,
3839
showCount = true,
40+
shouldFetch = true,
3941
}: Props) {
4042
const { filters, setFilterValue, clearValues } = useLocalUIFilters({
4143
filterNames,
4244
projection,
4345
params,
46+
shouldFetch,
4447
});
4548

4649
const hasValues = filters.some((filter) => filter.value.length > 0);

x-pack/plugins/apm/public/components/shared/charts/chart_container.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ChartContainer } from './chart_container';
1111
describe('ChartContainer', () => {
1212
describe('loading indicator', () => {
1313
it('shows loading when status equals to Loading or Pending and has no data', () => {
14-
[FETCH_STATUS.PENDING, FETCH_STATUS.LOADING].map((status) => {
14+
[FETCH_STATUS.NOT_INITIATED, FETCH_STATUS.LOADING].map((status) => {
1515
const { queryAllByTestId } = render(
1616
<ChartContainer
1717
height={100}
@@ -26,7 +26,7 @@ describe('ChartContainer', () => {
2626
});
2727
});
2828
it('does not show loading when status equals to Loading or Pending and has data', () => {
29-
[FETCH_STATUS.PENDING, FETCH_STATUS.LOADING].map((status) => {
29+
[FETCH_STATUS.NOT_INITIATED, FETCH_STATUS.LOADING].map((status) => {
3030
const { queryAllByText } = render(
3131
<ChartContainer height={100} status={status} hasData={true}>
3232
<div>My amazing component</div>

0 commit comments

Comments
 (0)