-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(perf): Perf Landing v3 UI Tweaks #29812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf06571
f9081cb
db83e0c
58dd9c3
f5e5dcf
02fc67a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import {Fragment, FunctionComponent, useMemo, useState} from 'react'; | |
| import {withRouter} from 'react-router'; | ||
| import styled from '@emotion/styled'; | ||
| import {Location} from 'history'; | ||
| import pick from 'lodash/pick'; | ||
|
|
||
| import _EventsRequest from 'app/components/charts/eventsRequest'; | ||
| import {getInterval} from 'app/components/charts/utils'; | ||
|
|
@@ -92,7 +93,6 @@ export function LineChartListWidget(props: Props) { | |
| eventView.query = mutableSearch.formatString(); | ||
| } else if (isSlowestType) { | ||
| eventView.additionalConditions.setFilterValues('epm()', ['>0.01']); | ||
| eventView.additionalConditions.setFilterValues(field, ['>0']); | ||
| eventView.fields = [ | ||
| {field: 'transaction'}, | ||
| {field: 'project.id'}, | ||
|
|
@@ -103,6 +103,8 @@ export function LineChartListWidget(props: Props) { | |
| // Most related errors | ||
| eventView.fields = [{field: 'transaction'}, {field: 'project.id'}, {field}]; | ||
| } | ||
| // Don't retrieve list items with 0 in the field. | ||
| eventView.additionalConditions.setFilterValues(field, ['>0']); | ||
| return ( | ||
| <DiscoverQuery | ||
| {...provided} | ||
|
|
@@ -114,7 +116,7 @@ export function LineChartListWidget(props: Props) { | |
| }, | ||
| transform: transformDiscoverToList, | ||
| }), | ||
| [props.eventView.query, field, props.organization.slug] | ||
| [props.eventView, field, props.organization.slug] | ||
| ); | ||
|
|
||
| const chartQuery = useMemo<QueryDefinition<DataType, WidgetDataResult>>(() => { | ||
|
|
@@ -125,10 +127,16 @@ export function LineChartListWidget(props: Props) { | |
| fields: field, | ||
| component: provided => { | ||
| const eventView = props.eventView.clone(); | ||
| if (!provided.widgetData.list.data[selectedListIndex]?.transaction) { | ||
| return null; | ||
| } | ||
| eventView.additionalConditions.setFilterValues('transaction', [ | ||
| provided.widgetData.list.data[selectedListIndex].transaction as string, | ||
| ]); | ||
| if (props.chartSetting === PerformanceWidgetSetting.MOST_RELATED_ISSUES) { | ||
| if (!provided.widgetData.list.data[selectedListIndex]?.issue) { | ||
| return null; | ||
| } | ||
| eventView.fields = [ | ||
| {field: 'issue'}, | ||
| {field: 'issue.id'}, | ||
|
|
@@ -148,7 +156,7 @@ export function LineChartListWidget(props: Props) { | |
| } | ||
| return ( | ||
| <EventsRequest | ||
| {...provided} | ||
| {...pick(provided, ['children', 'organization', 'yAxis'])} | ||
| limit={1} | ||
| includePrevious | ||
| includeTransformedData | ||
|
|
@@ -168,7 +176,7 @@ export function LineChartListWidget(props: Props) { | |
| }, | ||
| transform: transformEventsRequestToArea, | ||
| }; | ||
| }, [props.eventView.query, field, props.organization.slug, selectedListIndex]); | ||
| }, [props.eventView, field, props.organization.slug, selectedListIndex]); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't say with confidence that I have a strong grasp on what this will do but won't this trigger a re-render on every location change because
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it schedules a rerender, but eventView is no longer being passed to the query component, so the component itself never refires. Re-renders are fine, but re-firing the api request is not. The eventView has more than just the query to look for (in this case statsPeriod was changing), I'd rather not figure out primitives for every facet of eventView that could change and just let the existing component refetch mechanism deal with it. |
||
|
|
||
| const Queries = { | ||
| list: listQuery, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ import {Fragment, FunctionComponent, useMemo} from 'react'; | |
| import {withRouter} from 'react-router'; | ||
| import styled from '@emotion/styled'; | ||
| import {Location} from 'history'; | ||
| import pick from 'lodash/pick'; | ||
|
|
||
| import _EventsRequest from 'app/components/charts/eventsRequest'; | ||
| import {getInterval} from 'app/components/charts/utils'; | ||
|
|
@@ -13,7 +14,7 @@ import _DurationChart from 'app/views/performance/charts/chart'; | |
|
|
||
| import {GenericPerformanceWidget} from '../components/performanceWidget'; | ||
| import {transformEventsRequestToArea} from '../transforms/transformEventsToArea'; | ||
| import {WidgetDataResult} from '../types'; | ||
| import {QueryDefinition, WidgetDataResult} from '../types'; | ||
|
|
||
| type Props = { | ||
| title: string; | ||
|
|
@@ -28,7 +29,7 @@ type Props = { | |
| ContainerActions: FunctionComponent<{isLoading: boolean}>; | ||
| }; | ||
|
|
||
| type AreaDataType = { | ||
| type DataType = { | ||
| chart: WidgetDataResult & ReturnType<typeof transformEventsRequestToArea>; | ||
| }; | ||
|
|
||
|
|
@@ -39,38 +40,41 @@ export function SingleFieldAreaWidget(props: Props) { | |
| if (props.fields.length !== 1) { | ||
| throw new Error(`Single field area can only accept a single field (${props.fields})`); | ||
| } | ||
| const field = props.fields[0]; | ||
|
|
||
| const Queries = useMemo(() => { | ||
| return { | ||
| chart: { | ||
| fields: props.fields[0], | ||
| component: provided => ( | ||
| <EventsRequest | ||
| {...provided} | ||
| limit={1} | ||
| includePrevious | ||
| includeTransformedData | ||
| partial | ||
| currentSeriesName={props.fields[0]} | ||
| eventView={props.eventView} | ||
| query={props.eventView.getQueryWithAdditionalConditions()} | ||
| interval={getInterval( | ||
| { | ||
| start: provided.start, | ||
| end: provided.end, | ||
| period: provided.period, | ||
| }, | ||
| 'medium' | ||
| )} | ||
| /> | ||
| ), | ||
| transform: transformEventsRequestToArea, | ||
| }, | ||
| }; | ||
| }, [props.eventView.query, props.fields[0], props.organization.slug]); | ||
| const chart = useMemo<QueryDefinition<DataType, WidgetDataResult>>( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand why the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-rendering the same component is fine now, building a new component inside an object each render isn't. Since it wasn't part of the jsx in the return iirc it was being rebuilt each time. |
||
| () => ({ | ||
| fields: props.fields[0], | ||
| component: provided => ( | ||
| <EventsRequest | ||
| {...pick(provided, ['children', 'organization', 'yAxis'])} | ||
| limit={1} | ||
| includePrevious | ||
| includeTransformedData | ||
| partial | ||
| currentSeriesNames={[field]} | ||
| query={props.eventView.getQueryWithAdditionalConditions()} | ||
| interval={getInterval( | ||
| { | ||
| start: provided.start, | ||
| end: provided.end, | ||
| period: provided.period, | ||
| }, | ||
| 'medium' | ||
| )} | ||
| /> | ||
| ), | ||
| transform: transformEventsRequestToArea, | ||
| }), | ||
| [props.eventView, field, props.organization.slug] | ||
| ); | ||
|
|
||
| const Queries = { | ||
| chart, | ||
| }; | ||
|
|
||
| return ( | ||
| <GenericPerformanceWidget<AreaDataType> | ||
| <GenericPerformanceWidget<DataType> | ||
| {...props} | ||
| Subtitle={() => ( | ||
| <Subtitle>{t('Compared to last %s ', globalSelection.datetime.period)}</Subtitle> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've never had an un-zoom feature, is there a reason why it's a necessity now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can zoom in a bunch of the widgets but there is no way to reset and unzoom, we're also currently not making 2nd requests to get the zoomed in data, I'd rather just exclude the ability for now.