Skip to content

Commit b1655a3

Browse files
authored
fix(discover) Fetch the first series instead of count (#15355)
Instead of always fetching count(id) on first load, select the first series in the option list. I've also fixed some downstream typing problems that didn't come up earlier as yAxisSelector is a jsx file.
1 parent 9f083b7 commit b1655a3

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/sentry/static/sentry/app/actionCreators/events.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type Options = {
1616
includePrevious?: boolean;
1717
limit?: number;
1818
query?: string;
19-
yAxis?: 'event_count' | 'user_count';
19+
yAxis?: string;
2020
field?: string[];
2121
referenceEvent?: string;
2222
};

src/sentry/static/sentry/app/views/events/eventsChart.jsx

+11-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,17 @@ class EventsChart extends React.Component {
101101
yAxisOptions: PropTypes.array,
102102
};
103103

104-
state = {
105-
yAxis: 'event_count',
106-
};
104+
constructor(props) {
105+
super(props);
106+
const value =
107+
props.yAxisOptions && props.yAxisOptions.length
108+
? props.yAxisOptions[0].value
109+
: undefined;
110+
111+
this.state = {
112+
yAxis: value,
113+
};
114+
}
107115

108116
handleYAxisChange = value => {
109117
this.setState({yAxis: value});

src/sentry/static/sentry/app/views/events/utils/eventsRequest.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type EventsRequestPartialProps = {
4747
includeTransformedData?: boolean;
4848
loading?: boolean;
4949
showLoading?: boolean;
50-
yAxis?: 'event_count' | 'user_count';
50+
yAxis?: string;
5151
children: (renderProps: RenderProps) => React.ReactNode;
5252
};
5353

0 commit comments

Comments
 (0)