Skip to content

Commit cfbe015

Browse files
committed
bug fix crash when no change detected
1 parent fd81dd7 commit cfbe015

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/views/codeAnalytics/InsightListView/ItemRender/SpanItemRendering.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,18 @@ export class SpanItemHtmlRendering{
5252
insight.percentiles.sort((a,b) => a.percentile - b.percentile);
5353
//todo move to file settings
5454
const tolerationConstant = 10000;
55+
5556
for(const item of insight.percentiles){
57+
let changeMeaningfulEnough = false;
5658
percentileHtmls.push(/*html*/ `<span>P${item.percentile*100}</span>`);
5759
percentileHtmls.push(/*html*/ `<span>${item.currentDuration.value} ${item.currentDuration.unit}</span>`);
58-
const rawDiff= Math.abs(item.currentDuration.raw-item.previousDuration.raw);
59-
const changeMeaningfulEnough = rawDiff/item.previousDuration.raw > 0.1 && rawDiff>tolerationConstant;
6060
if (item.previousDuration &&
6161
item.changeTime &&
6262
changeMeaningfulEnough ){
6363

64+
const rawDiff= Math.abs(item.currentDuration.raw-item.previousDuration.raw);
65+
changeMeaningfulEnough = rawDiff/item.previousDuration.raw > 0.1 && rawDiff>tolerationConstant;
66+
6467
let verb = item.previousDuration.raw > item.currentDuration.raw ? 'dropped.png' : 'rose.png';
6568

6669
percentileHtmls.push(/*html*/ `

0 commit comments

Comments
 (0)