From eef18a46de8086e1c8cd8afacd19a15f2cac0384 Mon Sep 17 00:00:00 2001 From: Guillaume Peoc'h Date: Thu, 3 Nov 2022 15:53:09 +0100 Subject: [PATCH] SONAR-15675 Duplicated files and bad sorting when listing 500+ files --- .../components/MeasureContent.tsx | 4 ++++ .../__snapshots__/MeasureContent-test.tsx.snap | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx index bb89c2936dd..936a4aa5213 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.tsx @@ -131,6 +131,10 @@ export default class MeasureContent extends React.PureComponent { ([tree, measures]) => { if (this.mounted) { const metric = tree.metrics.find((m) => m.key === requestedMetric.key); + if (metric !== undefined) { + metric.direction = requestedMetric.direction; + } + const components = tree.components.map((component) => enhanceComponent(component, metric, metrics) ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureContent-test.tsx.snap b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureContent-test.tsx.snap index e81c83983dc..58696b8c502 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureContent-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/__snapshots__/MeasureContent-test.tsx.snap @@ -84,6 +84,7 @@ exports[`should render correctly for a file 1`] = ` measureValue="12" metric={ Object { + "direction": 1, "domain": "Reliability", "id": "1", "key": "bugs", @@ -178,6 +179,7 @@ exports[`should render correctly for a project 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -225,6 +227,7 @@ exports[`should render correctly for a project 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -272,6 +275,7 @@ exports[`should render correctly for a project 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -389,6 +393,7 @@ exports[`should render correctly when asc prop is defined 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -436,6 +441,7 @@ exports[`should render correctly when asc prop is defined 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -483,6 +489,7 @@ exports[`should render correctly when asc prop is defined 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -600,6 +607,7 @@ exports[`should render correctly when view prop is tree 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -647,6 +655,7 @@ exports[`should render correctly when view prop is tree 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -694,6 +703,7 @@ exports[`should render correctly when view prop is tree 1`] = ` "bestValue": "0", "custom": false, "description": "Bugs", + "direction": 1, "domain": "Reliability", "hidden": false, "higherValuesAreBetter": false, @@ -808,6 +818,7 @@ exports[`should test fetchMoreComponents to work correctly 1`] = ` handleViewChange={[Function]} metric={ Object { + "direction": 1, "domain": "Reliability", "id": "1", "key": "bugs", @@ -850,6 +861,7 @@ exports[`should test fetchMoreComponents to work correctly 1`] = ` measureValue="12" metric={ Object { + "direction": 1, "domain": "Reliability", "id": "1", "key": "bugs", @@ -867,6 +879,7 @@ exports[`should test fetchMoreComponents to work correctly 1`] = ` loadingMore={true} metric={ Object { + "direction": 1, "domain": "Reliability", "id": "1", "key": "bugs", @@ -877,6 +890,7 @@ exports[`should test fetchMoreComponents to work correctly 1`] = ` metrics={ Object { "bugs": Object { + "direction": 1, "domain": "Reliability", "id": "1", "key": "bugs", -- 2.39.5