Skip to content

Commit 6597345

Browse files
authored
ref(dashboards): make WidgetCardChart functional (#97885)
### Changes Make `WidgetCardChart` functional. Also doesn't seem like `expandNumbers` is used anymore. I'll look into opening another PR to clean up the props if this one gets merged in
1 parent 127ce43 commit 6597345

File tree

3 files changed

+545
-566
lines changed

3 files changed

+545
-566
lines changed

static/app/components/modals/widgetViewerModal.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ import useProjects from 'sentry/utils/useProjects';
7070
import {useUser} from 'sentry/utils/useUser';
7171
import {useUserTeams} from 'sentry/utils/useUserTeams';
7272
import withPageFilters from 'sentry/utils/withPageFilters';
73-
// eslint-disable-next-line no-restricted-imports
74-
import withSentryRouter from 'sentry/utils/withSentryRouter';
7573
import {getDatasetConfig} from 'sentry/views/dashboards/datasetConfig/base';
7674
import {checkUserHasEditAccess} from 'sentry/views/dashboards/detail';
7775
import {DiscoverSplitAlert} from 'sentry/views/dashboards/discoverSplitAlert';
@@ -157,13 +155,10 @@ const EMPTY_QUERY_NAME = '(Empty Query Condition)';
157155

158156
const shouldWidgetCardChartMemo = (prevProps: any, props: any) => {
159157
const selectionMatches = props.selection === prevProps.selection;
160-
const sortMatches =
161-
props.location.query[WidgetViewerQueryField.SORT] ===
162-
prevProps.location.query[WidgetViewerQueryField.SORT];
163158
const isNotTopNWidget =
164159
props.widget.displayType !== DisplayType.TOP_N && !defined(props.widget.limit);
165160
const legendMatches = isEqual(props.legendOptions, prevProps.legendOptions);
166-
return selectionMatches && (sortMatches || isNotTopNWidget) && legendMatches;
161+
return selectionMatches && isNotTopNWidget && legendMatches;
167162
};
168163

169164
// WidgetCardChartContainer and WidgetCardChart rerenders if selection was changed.
@@ -173,9 +168,7 @@ const MemoizedWidgetCardChartContainer = memo(
173168
WidgetCardChartContainer,
174169
shouldWidgetCardChartMemo
175170
);
176-
const MemoizedWidgetCardChart = withSentryRouter(
177-
memo(WidgetCardChart, shouldWidgetCardChartMemo)
178-
);
171+
const MemoizedWidgetCardChart = memo(WidgetCardChart, shouldWidgetCardChartMemo);
179172

180173
async function fetchDiscoverTotal(
181174
api: Client,
@@ -927,7 +920,6 @@ function WidgetViewerModal(props: Props) {
927920
loading={false}
928921
widget={widget}
929922
selection={selection}
930-
organization={organization}
931923
onZoom={(_evt, chart) => {
932924
onZoom(_evt, chart);
933925
setChartUnmodified(false);
@@ -936,7 +928,6 @@ function WidgetViewerModal(props: Props) {
936928
legendOptions={{
937929
selected: widgetLegendState.getWidgetSelectionState(widget),
938930
}}
939-
expandNumbers
940931
noPadding
941932
widgetLegendState={widgetLegendState}
942933
showConfidenceWarning={widget.widgetType === WidgetType.SPANS}

0 commit comments

Comments
 (0)